/**
 @date 2009-12-22

 @version v2.0

---file comments----
*/

/****************************************************************************
 *
 * Header files
 *
 *****************************************************************************/
#include "ctc_cli.h"
#include "ctc_cli_common.h"
#include "ctc_api.h"
#include "ctcs_api.h"
#include "ctc_debug.h"
#include "ctc_error.h"
#include "ctc_acl_cli.h"
#include "ctc_mirror.h"
#include "ctc_field.h"
#include "ctc_xdata_cli.h"

#include "ctc_port_mapping_cli.h"

extern int32
sys_usw_acl_show_entry(uint8 lchip, uint8 type, uint32 param, uint16 key_type, uint8 detail, ctc_field_key_t* p_grep, uint8 grep_cnt, uint8 show_inner);

extern int32
sys_usw_acl_show_entry_distribution(uint8 lchip, uint8 dir, uint8 priority);

extern int32
sys_usw_acl_show_status(uint8 lchip);

extern int32
sys_usw_acl_set_global_cfg(uint8 lchip, uint8 property, uint32 value);

extern int32
sys_usw_acl_show_tcp_flags(uint8 lchip);

extern int32
sys_usw_acl_show_field_range(uint8 lchip);

extern int32
sys_usw_acl_set_tcam_mode(uint8 lchip, uint8 mode);

extern int32
sys_usw_dma_set_tcam_interval(uint8 lchip, uint32 interval);

extern int32
sys_usw_acl_show_group(uint8 lchip, uint8 type);

extern int32
sys_usw_acl_show_cid_pair(uint8 lchip, uint8 type);

extern int32
sys_usw_acl_show_tcam_alloc_status(uint8 lchip, uint8 dir, uint8 block_id, uint8 detail, uint8 is_virtual);

extern int32
sys_usw_acl_set_cid_priority(uint8 lchip, uint8 is_src_cid, uint8* p_prio_arry);
extern int32
sys_usw_acl_dump_udf_entry_info(uint8 lchip);
extern int32 sys_usw_acl_set_upa_en(uint8 lchip);
extern uint8
SYS_PP_BASE(uint8 lchip);
extern uint32 
sys_usw_acl_get_lkup_pp_en_bmp(uint8 lchip, uint8 dir);
extern int32
sys_usw_acl_get_upa_en(uint8 lchip, uint8 dir, uint8* p_enable);


#define CTC_CLI_ACL_COMMON_VAR \
    mac_addr_t  mac_da_addr = {0};\
    mac_addr_t  mac_da_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};\
    mac_addr_t  mac_sa_addr = {0};\
    mac_addr_t  mac_sa_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};\
    mac_addr_t  arp_sender_mac_addr = {0};\
    mac_addr_t  arp_sender_mac_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};\
    mac_addr_t  arp_target_mac_addr = {0};\
    mac_addr_t  arp_target_mac_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};\
    mac_addr_t  wlan_radio_mac_addr = {0};\
    mac_addr_t  wlan_radio_mac_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};\
    ipv6_addr_t ipv6_da_addr = {0};\
    ipv6_addr_t ipv6_da_addr_mask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};\
    ipv6_addr_t ipv6_sa_addr = {0};\
    ipv6_addr_t ipv6_sa_addr_mask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};\
    uint32 svrange_gid = 0;\
    uint32 cvrange_gid = 0; \
    uint32 discard_type = 0;

const char *cli_key_str[] = {
"mac-key",
"ipv4-key",
"mpls-key",
"ipv6-key",
"hash-mac-key",
"hash-ipv4-key",
"hash-l2-l3-key",
"hash-mpls-key",
"hash-ipv6-key",
"hash-nsh-key",
"pbr-ipv4-key",
"pbr-ipv6-key",
"ipv4-ext-key",
"mac-ipv4-key",
"mac-ipv4-ext-key",
"ipv6-ext-key",
"mac-ipv6-key",
"cid-key",
"interface-key",
"fwd-key",
"fwd-ext-key",
"copp-key",
"copp-ext-key",
"udf-key",
"stk-hdr-key"
};

/****************************************************************************
 *
 * Function
 *
 *****************************************************************************/
CTC_CLI(ctc_cli_usw_acl_show_group_info,
        ctc_cli_usw_acl_show_group_info_cmd,
        "show acl group-info ",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Group info")
{
    int32 ret = CLI_SUCCESS;
    uint8 type = 0;


    ret = sys_usw_acl_show_group(g_api_lchip, type);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_status,
        ctc_cli_usw_acl_show_status_cmd,
        "show acl status ",
        "Show",
        CTC_CLI_ACL_STR,
        "Status"
        )
{
    int32 ret = 0;

    ret = sys_usw_acl_show_status(g_api_lchip);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;

}

CTC_CLI(ctc_cli_usw_acl_show_field_range,
        ctc_cli_usw_acl_show_field_range_cmd,
        "show acl field-range",
        "Show",
        CTC_CLI_ACL_STR,
        "Field Range"
        )
{

    int32 ret = CLI_SUCCESS;
    ret = sys_usw_acl_show_field_range(g_api_lchip);

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

#define CTC_CLI_ACL_REVERT_U32_ARRAY(d) \
    do\
    {\
        uint32 temp = 0; \
        uint8  i = 0;\
        uint8 len = sizeof(d)/sizeof(uint32);\
        for(i=0; i<len/2; i++)\
        {\
            temp = d[i]; d[i]=d[len-i-1];d[len-i-1]=temp;\
        }\
    }while(0)

#define CTC_CLI_ACL_KEY_FIELD_PORT_BIMAP_STR    "port-bitmap (LCHIP PORT_BITMAP_3 PORT_BITMAP_2 PORT_BITMAP_1 PORT_BITMAP_0|) |\
    pbm-list (LCHIP PBM_LIST|)"

#define CTC_CLI_ACL_KEY_FIELD_PORT_BIMAP_DESC    CTC_CLI_ACL_PORT_BITMAP,CTC_CLI_LCHIP_ID_VALUE,\
          "Port bitmap_3 <port96~port127>"  ,"Port bitmap_2 <port64~port95>"   ,"Port bitmap_1 <port32~port63>"   ,"Port bitmap_0 <port0~port31>",\
          "Pbm list" , CTC_CLI_LCHIP_ID_VALUE , "Port bitmap list <[pbm0,pbm1,...]>"


#define CTC_CLI_ACL_KEY_FIELD_STR_0 "\
  l2-type (VALUE (MASK|)|) \
| l3-type (VALUE (MASK|)|) \
| l3-ext-type (VALUE (MASK|)|) \
| l4-type (VALUE (MASK|)|) \
| l4-user-type (VALUE (MASK|)|) \
| field-port (port-class (CLASS_ID (MASK|)|) | \
    vlan-class (CLASS_ID (MASK|)|) | \
    l3if-class  (CLASS_ID (MASK|)|) | \
    pbr-class (CLASS_ID (MASK|)|) | \
    logic-port (LOGICAL_PORT (MASK|)|) | \
    gport (GPORT (MASK|)|) | \
    "CTC_CLI_ACL_KEY_FIELD_PORT_BIMAP_STR") \
| port-bitmap (LCHIP PORT_BITMAP_LIST|) \
| mac-sa (VALUE (MASK|)|) \
| mac-da (VALUE (MASK|)|) \
| stag-valid (VALUE (MASK|)|) \
| svlan-id (VALUE (MASK|)|) \
| stag-cos (VALUE (MASK|)|) \
| stag-cfi (VALUE (MASK|)|) \
| ctag-valid (VALUE (MASK|)|) \
| cvlan-id (VALUE (MASK|)|) \
| ctag-cos (VALUE (MASK|)|) \
| ctag-cfi (VALUE (MASK|)|) \
| svlan-range (MIN MAX vrange-gid GID |)  \
| cvlan-range (MIN MAX vrange-gid GID |) \
| ether-type (VALUE (MASK|)|) \
| vlan-num (VALUE (MASK|)|) \
| vlan-xlate-hit scl-id SCL_ID (VALUE (MASK|)|) \
| ip-sa (VALUE (MASK|)|) \
| ip-da (VALUE (MASK|)|) \
| ipv6-sa (VALUE (MASK|)|) \
| ipv6-da (VALUE (MASK|)|) \
| ipv6-flow-label (VALUE (MASK|)|) \
| ip-protocol (VALUE (MASK|)|) \
| ip-dscp (VALUE (MASK|)|) \
| ip-precedence (VALUE (MASK|)|) \
| ip-ecn (VALUE (MASK|)|) \
| ip-frag (VALUE (MASK|)|) \
| ip-hdr-error (VALUE (MASK|)|) \
| ip-options (VALUE (MASK|)|) \
| ip-pkt-len-range (MIN (MAX|)|) \
| ip-ttl (VALUE (MASK|)|) \
| arp-op-code (VALUE (MASK|)|) \
| arp-protocol-type (VALUE (MASK|)|) \
| arp-sender-ip (VALUE (MASK|)|) \
| arp-target-ip (VALUE (MASK|)|) \
| rarp (VALUE (MASK|)|) \
| l4-dst-port (VALUE (MASK|)|) \
| l4-src-port (VALUE (MASK|)|) \
| l4-src-port-range (MIN (MAX|)|) \
| l4-dst-port-range (MIN (MAX|)|) \
| tcp-ecn (VALUE (MASK|)|) \
| tcp-flags (VALUE (MASK|)|) \
| gre-key (VALUE (MASK|)|) \
| gre-flags (VALUE (MASK|)|) \
| gre-protocol (VALUE (MASK|)|) \
| nvgre-key (VALUE (MASK|)|) \
| vn-id (VALUE (MASK|)|) \
| vxlan-flags (VALUE (MASK|)|) \
| vxlan-rsv1 (VALUE (MASK|)|) \
| vxlan-rsv2 (VALUE (MASK|)|) \
| icmp-code (VALUE (MASK|)|) \
| icmp-type (VALUE (MASK|)|) \
| igmp-type (VALUE (MASK|)|) \
| label-num (VALUE (MASK|)|) \
| mpls-label0 (VALUE (MASK|)|) \
| mpls-exp0 (VALUE (MASK|)|) \
| mpls-sbit0 (VALUE (MASK|)|) \
| mpls-ttl0 (VALUE (MASK|)|) \
| arp-sender-mac (VALUE (MASK|)|) \
| arp-target-mac (VALUE (MASK|)|) \
| aware-tunnel-info (grekey (VALUE (MASK|)|) | vnid (VALUE (MASK|)|) | (wlan {radio-mac VALUE (MASK|)|radio-id VALUE (MASK|)|ctl-pkt VALUE (MASK|)|} ))  \
| stp-state (VALUE (MASK|)|) \
| arp-mac-da-chk-fail (VALUE (MASK|)|) \
| arp-mac-sa-chk-fail (VALUE (MASK|)|) \
| arp-senderip-chk-fail (VALUE (MASK|)|) \
| arp-targetip-chk-fail (VALUE (MASK|)|) \
| garp (VALUE (MASK|)|) \
| is-arp-pkt (VALUE (MASK|)|) \
| is-log-pkt (VALUE (MASK|)|) \
| satpdu-pdu-byte VALUE MASK \
| l2-station-move (VALUE (MASK|)|) \
| mac-security-discard (VALUE (MASK|)|) \
| pkt-fwd-type (VALUE (MASK|)|) \
| is-mcast-rpf-chk-fail (VALUE (MASK|)|) \
| is-route-mac (VALUE (MASK|)|) \
| inner-is-route-mac (VALUE (MASK|)|) \
| pi-stag-valid (VALUE (MASK|)|) \
| pi-ctag-valid (VALUE (MASK|)|) \
| inner-head (VALUE (MASK|)|) \
| is-my-sid (VALUE (MASK|)|) \
| aps-protect1-en (VALUE (MASK|)|) \
| sniffing-pkt (VALUE (MASK|)|) \
| l4-hdr-error (VALUE (MASK|)|) \
| len-error (VALUE (MASK|)|) \
| to-stk (VALUE (MASK|)|) \
"

#define CTC_CLI_ACL_KEY_FIELD_STR_1 "\
 mpls-label1 (VALUE (MASK|)|) \
| mpls-exp1 (VALUE (MASK|)|) \
| mpls-sbit1 (VALUE (MASK|)|) \
| mpls-ttl1 (VALUE (MASK|)|) \
| mpls-label2 (VALUE (MASK|)|) \
| mpls-exp2 (VALUE (MASK|)|) \
| mpls-sbit2 (VALUE (MASK|)|) \
| mpls-ttl2 (VALUE (MASK|)|) \
| mpls-label3 (VALUE (MASK|)|) \
| mpls-label4 (VALUE (MASK|)|) \
| mpls-label5 (VALUE (MASK|)|) \
| mpls-label6 (VALUE (MASK|)|) \
| mpls-label7 (VALUE (MASK|)|) \
| mpls-cw (VALUE (MASK|)|) \
| mpls-fwd-label (VALUE (MASK|)|) \
| mpls-fwd-exp (VALUE (MASK|)|) \
| mpls-fwd-sbit (VALUE (MASK|)|) \
| mpls-fwd-ttl (VALUE (MASK|)|) \
| mpls-im-flow-id (VALUE (MASK|)|) \
| npm-im-l-flag (VALUE (MASK|)|) \
| npm-im-d-flag (VALUE (MASK|)|) \
| nsh-cbit (VALUE (MASK|)|) \
| nsh-obit (VALUE (MASK|)|) \
| nsh-next-protocol (VALUE (MASK|)|) \
| nsh-si (VALUE (MASK|)|) \
| nsh-spi (VALUE (MASK|)|) \
| nsh-terminal (VALUE (MASK|)|) \
| is-y1731-oam (VALUE (MASK|)|) \
| ether-oam-level (VALUE (MASK|)|) \
| ether-oam-op-code (VALUE (MASK|)|) \
| ether-oam-version (VALUE (MASK|)|) \
| slow-protocol-code (VALUE (MASK|)|) \
| slow-protocol-flags (VALUE (MASK|)|) \
| slow-protocol-sub-type (VALUE (MASK|)|) \
| ptp-message-type (VALUE (MASK|)|) \
| ptp-version (VALUE (MASK|)|) \
| fcoe-dst-fcid (VALUE (MASK|)|) \
| fcoe-src-fcid (VALUE (MASK|)|) \
| wlan-radio-mac (VALUE (MASK|)|) \
| wlan-radio-id (VALUE (MASK|)|) \
| wlan-ctl-pkt (VALUE (MASK|)|) \
| satpdu-mef-oui (VALUE (MASK|)|) \
| satpdu-oui-sub-type (VALUE (MASK|)|) \
| ingress-nickname (VALUE (MASK|)|) \
| egress-nickname (VALUE (MASK|)|) \
| is-esadi (VALUE (MASK|)|) \
| is-trill-channel (VALUE (MASK|)|) \
| trill-inner-vlanid (VALUE (MASK|)|) \
| trill-inner-vlanid-valid (VALUE (MASK|)|) \
| trill-key-type (VALUE (MASK|)|) \
| trill-length (VALUE (MASK|)|) \
| trill-multihop (VALUE (MASK|)|) \
| trill-multicast (VALUE (MASK|)|) \
| trill-version (VALUE (MASK|)|) \
| trill-ttl (VALUE (MASK|)|) \
| dst-category-id (VALUE (MASK|)|) \
| src-category-id (VALUE (MASK|)|) \
| udf (udf-id UDF_ID {udf-data VALUE MASK| }|) \
| udf-ad-id (UDF_AD_ID {udf-data VALUE MASK|}|) \
| sudf (udf-id UDF_ID {udf-data VALUE MASK| }|) \
| sudf-ad-id (UDF_AD_ID {udf-data VALUE MASK|}|) \
| udf-range ((udf-id UDF_ID | udf-ad-id UDF_AD_ID) sel-id SELID mask MASK (MIN (MAX|)|)|) \
| sudf-range ((sudf-id SUDF_ID | sudf-ad-id SUDF_AD_ID) sel-id SELID mask MASK (MIN (MAX|)|)|) \
| decap (VALUE (MASK|)|) \
| encap (VALUE (MASK|)|) \
| elephant-pkt (VALUE (MASK|)|) \
| vxlan-pkt (VALUE (MASK|)|) \
| int-pkt (VALUE (MASK|)|) \
| routed-pkt (VALUE (MASK|)|) \
| macsa-lkup (VALUE (MASK|)|) \
| macsa-hit (VALUE (MASK|)|) \
| macda-lkup (VALUE (MASK|)|) \
| macda-hit (VALUE (MASK|)|) \
| ipsa-lkup (VALUE (MASK|)|) \
| ipsa-hit (VALUE (MASK|)|) \
| ipda-lkup (VALUE (MASK|)|) \
| ipda-hit (VALUE (MASK|)|) \
| discard (VALUE (MASK|)|) (discard-type TYPE|) \
| cpu-reason-id (VALUE (MASK|)|) (is-acl-match-group|) \
| dst-gport (VALUE (MASK|)|) \
| dst-nhid (VALUE (MASK|)|) \
| dst-nh-offset (VALUE (MASK|)|) \
| interface-id (VALUE (MASK|)|) \
| vrfid (VALUE (MASK|)|) \
| metadata (VALUE (MASK|)|) \
| customer-id (VALUE (MASK|)|) \
| hash-valid (VALUE (MASK|)|) \
| dot1ae-es(VALUE (MASK|)|) \
| dot1ae-sc(VALUE (MASK|)|) \
| dot1ae-an(VALUE (MASK|)|) \
| dot1ae-sl(VALUE (MASK|)|) \
| dot1ae-pn(VALUE (MASK|)|) \
| dot1ae-sci VALUE MASK \
| dot1ae-unknow-pkt (VALUE (MASK|)|) \
| dot1ae-cbit(VALUE (MASK|)|) \
| dot1ae-ebit(VALUE (MASK|)|) \
| dot1ae-scb(VALUE (MASK|)|) \
| dot1ae-ver(VALUE (MASK|)|) \
| gem-port (VALUE (MASK|)|) \
| class-id (VALUE (MASK|)|) \
| arp-hardware-type (VALUE (MASK|)|) \
| arp-protocol-addlen (VALUE (MASK|)|) \
| arp-hardware-addlen (VALUE (MASK|)|) \
| pi-svlan-id (VALUE (MASK|)|) \
| pi-svlan-cfi (VALUE (MASK|)|) \
| pi-svlan-cos (VALUE (MASK|)|) \
| pi-cvlan-id (VALUE (MASK|)|) \
| pi-cvlan-cfi (VALUE (MASK|)|) \
| pi-cvlan-cos (VALUE (MASK|)|) \
| port-cid (VALUE (MASK|)|) \
| vlan-cid (VALUE (MASK|)|) \
| l3if-cid (VALUE (MASK|)|) \
| scl-cid (VALUE (MASK|)|) \
| tunnel-cid (VALUE (MASK|)|) \
| flow-cid (VALUE (MASK|)|) \
| forward-cid (VALUE (MASK|)|) \
| nexthop-cid (VALUE (MASK|)|) \
| ldp-cid (VALUE (MASK|)|) \
| logic-src-port (VALUE (MASK|)|) \
| priority (VALUE (MASK|)|) \
| color (VALUE (MASK|)|) \
| ral-exist (VALUE (MASK|)|) \
| gal-exist (VALUE (MASK|)|) \
| cw-exist (VALUE (MASK|)|) \
| fid (VALUE (MASK|)|) \
| stk-hdr-exist {VALUE (MASK|)| hdr-type-bmp VALUE (MASK|)|} \
| stk-dst-gport (VALUE (MASK|)|) \
| stk-src-gport (VALUE (MASK|)|) \
| stk-logic-src-port (VALUE (MASK|)|) \
| stk-priority (VALUE (MASK|)|) \
| stk-src-cid (VALUE (MASK|)|) \
| stk-mirror-pkt (VALUE (MASK|)|) \
| stk-lkup (VALUE (MASK|)|) \
| stk-fid (VALUE (MASK|)|) \
| presel-entry-valid (VALUE (MASK|)|) \
| mirror-pkt (VALUE (MASK|)|) \
| int-type (VALUE (MASK|)|) \
| int-len (VALUE (MASK|)|) \
| int-ver (VALUE (MASK|)|) \
| int-ebit (VALUE (MASK|)|) \
| int-mbit (VALUE (MASK|)|) \
| int-hop-ml (VALUE (MASK|)|) \
| int-remain-hop-cnt (VALUE (MASK|)|) \
| int-instruction (VALUE (MASK|)|) \
| src-gport (VALUE (MASK|)|) \
| srv6-srh-flag  (VALUE (MASK|)|) \
| srv6-srh-le  (VALUE (MASK|)|) \
| srv6-srh-tag  (VALUE (MASK|)|) \
| srv6-srh-nh  (VALUE (MASK|)|) \
| srv6-srh-rt  (VALUE (MASK|)|) \
| srv6-srh-sl  (VALUE (MASK|)|) \
| lport  (VALUE (MASK|)|) \
| mark-ecn (VALUE (MASK|)|) \
| congest-event (VALUE (MASK|)|) \
| burst-event (VALUE (MASK|)|) \
| logic-dst-port (VALUE (MASK|)|) \
| nat-iftype (VALUE (MASK|)|) \
| xdata array-field FIELD \
| route-data  (VALUE (MASK|)|) \
| bfd-my-disc  (VALUE (MASK|)|) \
| bfd-your-disc  (VALUE (MASK|)|) \
"

#define CTC_CLI_ACL_KEY_FIELD_DESC_0 \
"Layer 2 type (ctc_parser_l2_type_t) ", "value", "mask",\
"Layer 3 type (ctc_parser_l3_type_t) ", "value", "mask",\
"Layer 3 ext type (ctc_parser_l3_ext_type_t)", "value", "mask",\
"Layer 4 type (ctc_parser_l4_type_t) ", "value", "mask",\
"Layer 4 user-type (ctc_parser_l4_usertype_t) ", "value", "mask",\
"Port-type","Port class id", "value","mask","Vlan class id","value", "mask","L3if class id","value", "mask","Pbr class id","value", "mask","Logic port","value", "mask","Global port","value", "mask",\
CTC_CLI_ACL_KEY_FIELD_PORT_BIMAP_DESC,\
"Port-bitmap", "Local chip id", "Port bitmap list",\
"Source mac address ","value", "mask",\
"Destination mac address ", "value", "mask",\
"S-vlan exist ", "value", "mask",\
"S-vlan id ", "value", "mask",\
"Stag cos ", "value", "mask",\
"Stag cfi ", "value", "mask",\
"C-vlan exist ", "value", "mask",\
"C-vlan id ", "value", "mask",\
"Ctag cos ", "value", "mask",\
"Ctag cfi ", "value", "mask",\
"S-vlan range", "min", "max", "Vlan range group id", "VALUE",\
"C-vlan range", "min", "max", "Vlan range group id", "VALUE",\
"Ether type ", "value", "mask",\
"Vlan tag number", "value", "mask",\
"Vlan xlate hit", "Scl id", "SCL ID", "value", "mask", \
"Source ipv4 address ", "value", "mask",\
"Destination ipv4 address ", "value", "mask",\
"Source ipv6 address ", "value", "mask",\
"Destination ipv6 address ", "value", "mask",\
"Ipv6 flow label", "value", "mask",\
"Ip protocol ", "value", "mask",\
"Dscp ", "value", "mask",\
"Precedence ", "value", "mask",\
"Ecn ", "value", "mask",\
"Ip fragment information ", "value", "mask",\
"Ip header error ", "value", "mask",\
"Ip options ", "value", "mask",\
"Ip packet length range ", "min", "max",\
"Ttl ", "value", "mask",\
"Opcode field of arp header ", "value", "mask",\
"Protocol type of arp header ", "value", "mask",\
"Sender ipv4 field of arp header ", "value", "mask",\
"Target ipv4 field of arp header ", "value", "mask",\
"Rarp", "value", "mask", \
"Layer 4 dest port ", "value", "mask",\
"Layer 4 src port ", "value", "mask",\
"Layer 4 src port range ", "min", "max",\
"Layer 4 dest port range ", "min", "max",\
"Tcp ecn ", "value", "mask",\
"Tcp flags ", "value", "mask",\
"Gre key ", "value", "mask",\
"Gre flags ", "value", "mask",\
"Gre protocol ", "value", "mask",\
"Nvgre key ", "value", "mask",\
"Vxlan network id ", "value", "mask",\
"Vxlan flags", "value", "mask", \
"Vxlan reserved 1", "value", "mask", \
"Vxlan reserved 2", "value", "mask", \
"Icmp code", "value", "mask",\
"Icmp type", "value", "mask",\
"Igmp type", "value", "mask",\
"Mpls label number ", "value", "mask",\
"Label field of the mpls label 0 ", "value", "mask",\
"Exp field of the mpls label 0", "value", "mask",\
"S-bit field of the mpls label 0", "value", "mask",\
"Ttl field of the mpls label 0", "value", "mask",\
"Ethernet Address of sender of ARP Header","value","mask",\
"Ethernet Address of destination of ARP Header","value","mask",\
"Aware Tunnel Info","Merge Key gre key","value","mask","Merge Key  vxlan vni","value","mask","Wlan type","Radio-mac","value","mask","Radio-id","value","mask","Wlan-ctl-pkt","value","mask",\
"Stp Status.Refer to stp_state_e; 0:forward, 1:blocking, and 2:learning","value","mask",\
"Destination MAC Address of ARP Header Check Fail", "value", "mask",\
"Source MAC Address of ARP Header Check Fail", "value", "mask",\
"IP Address of sender of ARP Header Check Fail", "value", "mask",\
"IP Address of destination of ARP Header Check Fail", "value", "mask",\
"Gratuitous ARP","value","mask",\
"Is ARP Packet","value","mask",\
"Log to Cpu Packet.","value","mask",\
"Satpdu Byte.","value","mask",\
"L2 Station Move.","value","mask",\
"Mac Security Discard.","value","mask",\
"Packet Forwarding Type"," Refer to ctc_acl_pkt_fwd_type_t","mask",\
"Mcast Rpf Check Fail","value","mask",\
"Route Mac","value","mask",\
"Inner Route Mac","value","mask",\
"S-vlan exist after translated","value","mask",\
"C-vlan exist after translated","value","mask",\
"ACL match inner pkt info","value","mask",\
"SRv6 is matched my SID table","value","mask",\
"Aps protection1 enable","value","mask",\
"Sniffing packet","value","mask", \
"Packet l4 hdr check error", "value", "mask", \
"Packet header len check error", "value", "mask", \
"Packet to stacking port", "value", "mask"



#define CTC_CLI_ACL_KEY_FIELD_DESC_1 \
"Label field of the mpls label 1 ", "value", "mask",\
"Exp field of the mpls label 1", "value", "mask",\
"S-bit field of the mpls label 1", "value", "mask",\
"Ttl field of the mpls label 1", "value", "mask",\
"Label field of the mpls label 2 ", "value", "mask",\
"Exp field of the mpls label 2", "value", "mask",\
"S-bit field of the mpls label 2", "value", "mask",\
"Ttl field of the mpls label 2", "value", "mask",\
"The mpls label 3 ", "value", "mask",\
"The mpls label 4 ", "value", "mask",\
"The mpls label 5 ", "value", "mask",\
"The mpls label 6 ", "value", "mask",\
"The mpls label 7 ", "value", "mask",\
"Mpls control word", "value", "mask",\
"Label field of mpls forwarding", "value", "mask",\
"Exp field of mpls forwarding", "value", "mask",\
"Sbit field of mpls forwarding", "value", "mask",\
"Ttl field of mpls forwarding", "value", "mask",\
"Mpls inband oam flowid", "value", "mask",\
"Npm im loss flag", "value", "mask",\
"Npm im delay flag", "value", "mask",\
"C-bit of the network service header ", "value", "mask",\
"O-bit of the network service header ", "value", "mask",\
"Next protocol of the network service header ", "value", "mask",\
"Service index of the network service header ", "value", "mask",\
"Service path id of the network service header ", "value", "mask",\
"Terminal the network service header ", "value", "mask",\
"Is y1731 oam ", "value", "mask",\
"Oam level ", "value", "mask",\
"Oam opcode ", "value", "mask",\
"Oam version ", "value", "mask",\
"Slow protocol code ", "value", "mask",\
"Slow protocol flags ", "value", "mask",\
"Slow protocol sub type ", "value", "mask",\
"Ptp message type ", "value", "mask",\
"Ptp message version ", "value", "mask",\
"Fcoe did", "value", "mask",\
"Fcoe sid", "value", "mask",\
"Wlan radio mac", "value", "mask",\
"Wlan radio id", "value", "mask",\
"Wlan control packet", "value", "mask",\
"Satpdu metro ethernet forum oui", "value", "mask",\
"Satpdu oui sub type", "value", "mask",\
"Ingress nick name ", "value", "mask",\
"Egress nick name ", "value", "mask",\
"Is esadi ", "value", "mask",\
"Is trill channel ", "value", "mask",\
"Trill inner vlan id ", "value", "mask",\
"Trill inner vlan id valid ", "value", "mask",\
"Trill key type ", "value", "mask",\
"Trill length ", "value", "mask",\
"Trill multi-hop ", "value", "mask",\
"Trill multicast ", "value", "mask",\
"Trill version ", "value", "mask",\
"Trill ttl ", "value", "mask",\
"Destination category id ", "value", "mask",\
"Source category id ", "value", "mask",\
"Udf","Udf id","Udf id value","Udf data","value","mask",\
"Udf action id","Udf action id value","Udf data","value","mask",\
"Service udf","Udf id","Udf id value","Udf data","value","mask",\
"Service udf action id","Udf action id value","Udf data","value","mask",\
"Udf range","Udf id","Udf id value","Udf action id","Udf action id value","Select id","Select id value, 0->[0:15], 1->[16-31], and so on","mask","mask value","min","max",\
"Service udf range","Service udf id","Service udf id value","Service udf action id","Serviec udf action id value","Select id","Select id value, 0->[0:15], 1->[16-31], and so on","mask","mask value","min","max",\
"Decapsulation occurred ", "value", "mask",\
"Encryp occurred ", "value", "mask",\
"Is elephant ", "value", "mask",\
"Is vxlan packet ", "value", "mask",\
"Is int packet ", "value", "mask",\
"Is routed packet ", "value", "mask",\
"Mac-sa lookup enable ", "value", "mask",\
"Mac-sa lookup hit ", "value", "mask",\
"Mac-da lookup enable ", "value", "mask",\
"Mac-da lookup hit ", "value", "mask",\
"L3-sa lookup enable ", "value", "mask",\
"L3-sa lookup hit ", "value", "mask",\
"L3-da lookup enable ", "value", "mask",\
"L3-da lookup hit ", "value", "mask",\
"Packet is flagged to be discarded ", "value", "mask", "Discard type", "value",\
"Cpu reason id ", "value", "mask", "Is acl match group",\
"Fwd destination port ", "value", "mask",\
"Nexthop id ", "value", "mask",\
"Nexthop offset ", "value", "mask",\
"L3 interface id ", "value", "mask",\
"Vrfid ", "value", "mask",\
"Metadata ", "value", "mask",\
"Customer id", "value", "mask",\
"Hash valid key", "value", "mask",\
"End Station (ES) bit. ", "value", "mask",\
"Secure Channel (SC) bit. ", "value", "mask",\
"Association Number (AN). ", "value", "mask",\
"Short Length (SL).", "value", "mask",\
"Packet Number.", "value", "mask",\
"Secure Channel Identifier. ", "value", "mask",\
"Unknow 802.1AE packet, SecTag error or Mode not support.","value", "mask", \
"Changed Text (C) bit", "value", "mask", \
"Encryption (E) bit", "value", "mask", \
"Single Copy Broadcast (SCB) bit", "value", "mask", \
"Version Number (V) bit", "value", "mask", \
"Gem Port", "value", "mask",\
"Class ID","value", "mask",\
"Arp hardware type","value", "mask", \
"Arp protocol addlen","value", "mask", \
"Arp hardware addlen","value", "mask", \
"Pi svlan id","value", "mask", \
"Pi svlan cfi","value", "mask", \
"Pi svlan cos","value", "mask", \
"Pi cvlan id","value", "mask", \
"Pi cvlan cfi","value", "mask", \
"Pi cvlan cos","value", "mask", \
"Port cid","value", "mask", \
"Vlan cid","value", "mask", \
"L3if cid","value", "mask", \
"Scl cid","value", "mask", \
"Tunnel cid","value", "mask", \
"Flow cid","value", "mask", \
"Fid cid","value", "mask", \
"Nexthop cid","value", "mask", \
"Logic dest port cid","value", "mask", \
"Logic src port","value", "mask", \
"Priority","value", "mask", \
"Color","value", "mask", \
"Ral exist","value", "mask", \
"Gal exist","value", "mask", \
"Cw exist","value", "mask", \
"Fid","value", "mask", \
"Stk hdr exist","value", "mask", "Stk hdr type bmp", "value", "mask", \
"Stk dst gport","value", "mask", \
"Stk src gport","value", "mask", \
"Stk logic src port","value", "mask", \
"Stk priority","value", "mask", \
"Stk src cid","value", "mask", \
"Stk mirror pkt","value", "mask", \
"Stk lkup","value", "mask", \
"Stk fid","value", "mask", \
"Presel entry valid", "value", "mask", \
"Mirror pkt", "value", "mask", \
"Int type", "value", "mask", \
"Int length", "value", "mask", \
"Int version", "value", "mask", \
"Int E bit", "value", "mask", \
"Int M bit", "value", "mask", \
"Int per hop metadadta length", "value", "mask", \
"Int remaining hop count", "value", "mask", \
"Int instruction bitmap", "value", "mask", \
"Src gport", "value", "mask", \
"Srv6 srh flag", "value", "mask", \
"Srv6 srh le", "value", "mask", \
"Srv6 srh tag", "value", "mask", \
"Srv6 srh nh", "value", "mask", \
"Srv6 srh rt", "value", "mask", \
"Srv6 srh sl", "value", "mask", \
"Local phy port", "value", "mask", \
"Marked ecn", "value", "mask", \
"Congest event", "value", "mask", \
"Burst event", "value", "mask", \
"Logic dest port", "value", "mask", \
"Nat iftype", "value", "mask",\
"XDATA","Field array of xdata key value","Two-dimensional Array,array number is ctc_xdata_field_t,format is [[WIDTH ,OFFSET ,DATA ,MASK ,FLAG],[...]].For example,[[8,48,0xff,0xff]],FLAG is invalid.",\
"route data", "value", "mask", \
"bfd my discriminator", "value", "mask", \
"bfd your discriminator", "value", "mask" \




#define CTC_CLI_ACL_FLEX_KEY_FIELD_DESC_1 \
"L2-TYPE",\
"L3-TYPE",\
"L3-EXT-TYPE",\
"L4-TYPE",\
"L4-USER-TYPE",\
"MAC-SA",\
"MAC-DA",\
"STAG-VALID",\
"PKT-STAG-VALID",\
"PKT-CTAG-VALID",\
"SVLAN-ID",\
"STAG-COS",\
"STAG-CFI",\
"CTAG-VALID",\
"CVLAN-ID",\
"CTAG-COS",\
"CTAG-CFI",\
"SVLAN-RANGE",\
"CVLAN-RANGE",\
"ETHER-TYPE",\
"VLAN-NUM",\
"STP-STATE",\
"MAPPED-STAG-VALID",\
"MAPPED-SVLAN-ID",\
"MAPPED-SVLAN-CFI",\
"MAPPED-SVLAN-COS",\
"MAPPED-CTAG-VALID",\
"MAPPED-CVLAN-ID",\
"MAPPED-CVLAN-CFI",\
"MAPPED-CVLAN-COS",\
"IP-SA",\
"IP-DA",\
"IPV6-SA",\
"IPV6-DA",\
"IPV6-FLOW-LABEL",\
"IP-PROTOCOL",\
"IP-DSCP",\
"IP-PRECEDENCE",\
"IP-ECN",\
"IP-FRAG",\
"IP-HDR-ERROR",\
"IP-OPTIONS",\
"IP-PKT-LEN-RANGE",\
"IP-TTL",\
"IS-IP-PKT",\
"ARP-OP-CODE",\
"ARP-PROTOCOL-TYPE",\
"ARP-SENDER-IP",\
"ARP-TARGET-IP",\
"ARP-MAC-DA-CHK-FAIL",\
"ARP-MAC-SA-CHK-FAIL",\
"ARP-SENDERIP-CHK-FAIL",\
"ARP-TARGETIP-CHK-FAIL",\
"GARP",\
"SENDER-MAC",\
"TARGET-MAC",\
"RARP",\
"ARP-HARDWARE-TYPE",\
"ARP-PROTOCOL-ADDLEN",\
"ARP-HARDWARE-ADDLEN",\
"IS-ARP-PKT",\
"L4-DST-PORT",\
"L4-SRC-PORT",\
"L4-SRC-PORT-RANGE",\
"L4-DST-PORT-RANGE",\
"TCP-ECN",\
"TCP-FLAGS",\
"TCP-OPTIONS",\
"GRE-KEY",\
"GRE-FLAGS",\
"GRE-PROTOCOL-TYPE",\
"NVGRE-KEY",\
"VN-ID",\
"VXLAN-FLAGS",\
"VXLAN-RSV1",\
"VXLAN-RSV2",\
"ICMP-CODE",\
"ICMP-TYPE",\
"IGMP-TYPE",\
"LABEL-NUM",\
"MPLS-LABEL0",\
"MPLS-EXP0",\
"MPLS-SBIT0",\
"MPLS-TTL0",\
"MPLS-LABEL1",\
"MPLS-EXP1",\
"MPLS-SBIT1",\
"MPLS-TTL1",\
"MPLS-LABEL2",\
"MPLS-EXP2",\
"MPLS-SBIT2",\
"MPLS-TTL2",\
"MPLS-LABEL3",\
"MPLS-LABEL4",\
"MPLS-LABEL5",\
"MPLS-LABEL6",\
"MPLS-LABEL7",\
"INTERFACE-ID",\
"RAL-EXIST",\
"GAL-EXIST",\
"CW-EXIST",\
"IP-OVER-MPLS",\
"IPV6-OVER-MPLS",\
"MPLS-CW",\
"MPLS-FWD-LABEL",\
"MPLS-FWD-EXP",\
"MPLS-FWD-SBIT",\
"MPLS-FWD-TTL",\
"NPM-IM-FLOW-ID",\
"NPM-IM-L-FLAG",\
"NPM-IM-D-FLAG",\
"NSH-CBIT",\
"NSH-OBIT",\
"NSH-NEXT-PROTOCOL",\
"NSH-SI",\
"NSH-SPI",\
"IS-Y1731-OAM",\
"ETHER-OAM-LEVEL",\
"ETHER-OAM-OP-CODE",\
"ETHER-OAM-VERSION",\
"SLOW-PROTOCOL-CODE",\
"SLOW-PROTOCOL-FLAGS",\
"SLOW-PROTOCOL-SUB-TYPE"
/*<FLEX_KEY_FIELD_DESC_1_END>*/

#define CTC_CLI_ACL_FLEX_KEY_FIELD_DESC_2 \
"PTP-MESSAGE-TYPE",\
"PTP-VERSION",\
"FCOE-DST-FCID",\
"FCOE-SRC-FCID",\
"WLAN-RADIO-MAC",\
"WLAN-RADIO-ID",\
"WLAN-CTL-PKT",\
"SATPDU-MEF-OUI",\
"SATPDU-OUI-SUB-TYPE",\
"SATPDU-PDU-BYTE",\
"INGRESS-NICKNAME",\
"EGRESS-NICKNAME",\
"IS-ESADI",\
"IS-TRILL-CHANNEL",\
"TRILL-INNER-VLANID",\
"TRILL-INNER-VLANID-VALID",\
"TRILL-KEY-TYPE",\
"TRILL-LENGTH",\
"TRILL-MULTIHOP",\
"TRILL-MULTICAST",\
"TRILL-VERSION",\
"TRILL-TTL",\
"DOT1AE-UNKNOW-PKT",\
"DOT1AE-ES",\
"DOT1AE-SC",\
"DOT1AE-AN",\
"DOT1AE-SL",\
"DOT1AE-PN",\
"DOT1AE-SCI",\
"DOT1AE-CBIT",\
"DOT1AE-EBIT",\
"DOT1AE-SCB",\
"DOT1AE-VER",\
"INT-TYPE",\
"INT-LEN",\
"INT-VER",\
"INT-EBIT",\
"INT-MBIT",\
"INT-HOP-ML",\
"INT-REMAIN-HOP-CNT",\
"INT-INSTRUCTION",\
"UDF",\
"SUDF",\
"UDF-RANGE",\
"UDF-AD-ID",\
"SUDF-AD-ID",\
"PORT",\
"LPORT",\
"CLASS-ID",\
"LOGIC-SRC-PORT",\
"LOGIC-DST-PORT",\
"SRC-GPORT",\
"DECAP",\
"ENCAP",\
"ELEPHANT-PKT",\
"VXLAN-PKT",\
"ROUTED-PKT",\
"PKT-FWD-TYPE",\
"MACSA-LKUP",\
"MACSA-HIT",\
"MACDA-LKUP",\
"MACDA-HIT",\
"IPSA-LKUP",\
"IPSA-HIT",\
"IPDA-LKUP",\
"IPDA-HIT",\
"L2-STATION-MOVE",\
"MAC-SECURITY-DISCARD",\
"DST-CID",\
"SRC-CID",\
"PORT-CID",\
"VLAN-CID",\
"L3IF-CID",\
"SCL-CID",\
"TUNNEL-CID",\
"FLOW-CID",\
"FID-CID",\
"DISCARD",\
"CPU-REASON-ID",\
"DST-GPORT",\
"DST-NHID",\
"DST-NH-OFFSET",\
"MCAST-RPF-CHECK-FAIL",\
"VRFID",\
"METADATA",\
"CUSTOMER-ID",\
"IS-LOG-PKT",\
"PRIORITY",\
"COLOR",\
"FID",\
"MIRROR-PKT",\
"ISOLATION-ID",\
"LP-GRP",\
"INNER-HEAD",\
"IS-MY-SID",\
"AWARE-TUNNEL-INFO",\
"HASH-VALID",\
"IS-ROUTER-MAC",\
"HASH-SEL-ID",\
"STK-HDR-EXIST",\
"STK-LKUP",\
"STK-DST-GPORT",\
"STK-SRC-GPORT",\
"STK-FID",\
"STK-LOGIC-SRC-PORT",\
"STK-PRIORITY",\
"STK-SRC-CID",\
"STK-MIRROR-PKT",\
"UDF-ENTRY-VALID",\
"VLAN-XLATE-HIT",\
"GEM-PORT",\
"PRESEL-ENTRY-VALID",\
"SRV6-SRH-FLAG",\
"SRV6-SRH-NH",\
"SRV6-SRH-RT",\
"SRV6-SRH-SL",\
"SRV6-SRH-LE",\
"SRV6-SRH-TAG",\
"SUDF-RANGE",\
"INT-PKT",\
"ROUTE-DATA",\
"BFD-MY-DISC",\
"BFD-YOUR-DISC"
/*<FLEX_KEY_FIELD_DESC_2_END>*/


#define CTC_CLI_ACL_KEY_FIELD_SET(key_field, arg, start)\
do{\
    index = CTC_CLI_GET_ARGC_INDEX("l2-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L2_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l3-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L3_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l3-ext-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L3_EXT_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-user-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_USER_TYPE;\
        if(is_add)\
        {\
        CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
        if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mac-sa");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MAC_SA;\
        if(is_add)\
        {\
            CTC_CLI_GET_MAC_ADDRESS("mac-sa", mac_sa_addr, argv[index + 1]);\
            key_field->ext_data = mac_sa_addr; \
            sal_memset(&mac_sa_addr_mask, 0xFF, sizeof(mac_addr_t));\
            if(index+2<argc){\
            CTC_CLI_GET_MAC_ADDRESS("mac-sa-mask", mac_sa_addr_mask, argv[index + 2]);\
            key_field->ext_mask = mac_sa_addr_mask;} \
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mac-da");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MAC_DA;\
        if(is_add)\
        {\
            key_field->type = CTC_FIELD_KEY_MAC_DA;\
            CTC_CLI_GET_MAC_ADDRESS("mac-da", mac_da_addr, argv[index + 1]);\
            key_field->ext_data = mac_da_addr; \
            sal_memset(&mac_da_addr_mask, 0xFF, sizeof(mac_addr_t));\
            if(index+2<argc){\
            CTC_CLI_GET_MAC_ADDRESS("mac-da-mask", mac_da_addr_mask, argv[index + 2]);\
            key_field->ext_mask = mac_da_addr_mask;} \
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stag-valid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_STAG_VALID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("svlan-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SVLAN_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if (index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]); \
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stag-cos");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_STAG_COS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stag-cfi");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_STAG_CFI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ctag-valid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CTAG_VALID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cvlan-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CVLAN_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ctag-cos");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CTAG_COS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ctag-cfi");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CTAG_CFI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("svlan-range");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SVLAN_RANGE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("min", key_field->data, argv[index + 1]);\
            CTC_CLI_GET_UINT32("max", key_field->mask, argv[index + 2]);\
            CTC_CLI_GET_UINT32("vrange-gid", svrange_gid, argv[index + 4]);\
            key_field->ext_data = &svrange_gid;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cvlan-range");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CVLAN_RANGE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("min", key_field->data, argv[index + 1]);\
            CTC_CLI_GET_UINT32("max", key_field->mask, argv[index + 2]);\
            CTC_CLI_GET_UINT32("vrange-gid", cvrange_gid, argv[index + 4]);\
            key_field->ext_data = &cvrange_gid;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ether-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ETHER_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vlan-num");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VLAN_NUM;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vlan-xlate-hit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VLAN_XLATE_HIT;\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("scl-id");\
            CTC_CLI_GET_UINT8("scl-id", scl_id, argv[index + 1]);\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 2]);\
            if(index+3<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 3]);\
            key_field->ext_data = (void*)&scl_id;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-sa");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_SA;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV4_ADDRESS("ipsa", key_field->data, argv[index + 1]);\
            key_field->mask = 0xFFFFFFFF;\
            if(index+2<argc) CTC_CLI_GET_IPV4_ADDRESS("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-da");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_DA;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV4_ADDRESS("ipda", key_field->data, argv[index + 1]);\
            key_field->mask = 0xFFFFFFFF;\
            if(index+2<argc) CTC_CLI_GET_IPV4_ADDRESS("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-sa");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPV6_SA;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV6_ADDRESS("ip-sa", ipv6_sa_addr, argv[index + 1]);               \
            ipv6_sa_addr[0] = sal_htonl(ipv6_sa_addr[0]);                                 \
            ipv6_sa_addr[1] = sal_htonl(ipv6_sa_addr[1]);                                 \
            ipv6_sa_addr[2] = sal_htonl(ipv6_sa_addr[2]);                                 \
            ipv6_sa_addr[3] = sal_htonl(ipv6_sa_addr[3]);                                 \
            key_field->ext_data = ipv6_sa_addr;    \
            if(index+2<argc)\
            {\
                if CLI_CLI_STR_EQUAL("HOST", index + 2)                                          \
                {                                                                             \
                    ipv6_sa_addr_mask[0] = 0xFFFFFFFF;                                            \
                    ipv6_sa_addr_mask[1] = 0xFFFFFFFF;                                            \
                    ipv6_sa_addr_mask[2] = 0xFFFFFFFF;                                            \
                    ipv6_sa_addr_mask[3] = 0xFFFFFFFF;                                            \
                    key_field->ext_mask = ipv6_sa_addr_mask;    \
                }                                                                             \
                else                                                                          \
                {                                                                             \
                    CTC_CLI_GET_IPV6_ADDRESS("ip-sa-mask", ipv6_sa_addr_mask, argv[index + 2]);          \
                    ipv6_sa_addr_mask[0] = sal_htonl(ipv6_sa_addr_mask[0]);                                 \
                    ipv6_sa_addr_mask[1] = sal_htonl(ipv6_sa_addr_mask[1]);                                 \
                    ipv6_sa_addr_mask[2] = sal_htonl(ipv6_sa_addr_mask[2]);                                 \
                    ipv6_sa_addr_mask[3] = sal_htonl(ipv6_sa_addr_mask[3]);                                 \
                    key_field->ext_mask = ipv6_sa_addr_mask;    \
                }\
            }\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("inner-head");\
    if (0xFF != index) \
    {\
       key_field->type = CTC_FIELD_KEY_INNER_HEAD;\
       if(is_add)\
       {\
           CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
           if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
       }\
       arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-my-sid");\
    if (0xFF != index) \
    {\
       key_field->type = CTC_FIELD_KEY_IS_MY_SID;\
       if(is_add)\
       {\
           CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
           if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
       }\
       arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("aps-protect1-en");\
    if (0xFF != index) \
    {\
       key_field->type = CTC_FIELD_KEY_APS_PROTECT1_EN;\
       if(is_add)\
       {\
           CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
           if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
       }\
       arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-da");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPV6_DA;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV6_ADDRESS("ip-da", ipv6_da_addr, argv[index + 1]);               \
            ipv6_da_addr[0] = sal_htonl(ipv6_da_addr[0]);                                 \
            ipv6_da_addr[1] = sal_htonl(ipv6_da_addr[1]);                                 \
            ipv6_da_addr[2] = sal_htonl(ipv6_da_addr[2]);                                 \
            ipv6_da_addr[3] = sal_htonl(ipv6_da_addr[3]);                                 \
            key_field->ext_data = ipv6_da_addr;    \
            if(index+2<argc)\
            {\
                if CLI_CLI_STR_EQUAL("HOST", index + 2)                                          \
                {                                                                             \
                    ipv6_da_addr_mask[0] = 0xFFFFFFFF;                                            \
                    ipv6_da_addr_mask[1] = 0xFFFFFFFF;                                            \
                    ipv6_da_addr_mask[2] = 0xFFFFFFFF;                                            \
                    ipv6_da_addr_mask[3] = 0xFFFFFFFF;                                            \
                    key_field->ext_mask = ipv6_da_addr_mask;    \
                }                                                                             \
                else                                                                          \
                {                                                                             \
                    CTC_CLI_GET_IPV6_ADDRESS("ip-da-mask", ipv6_da_addr_mask, argv[index + 2]);          \
                    ipv6_da_addr_mask[0] = sal_htonl(ipv6_da_addr_mask[0]);                                 \
                    ipv6_da_addr_mask[1] = sal_htonl(ipv6_da_addr_mask[1]);                                 \
                    ipv6_da_addr_mask[2] = sal_htonl(ipv6_da_addr_mask[2]);                                 \
                    ipv6_da_addr_mask[3] = sal_htonl(ipv6_da_addr_mask[3]);                                 \
                    key_field->ext_mask = ipv6_da_addr_mask;    \
                } \
            }\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-flow-label");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPV6_FLOW_LABEL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-protocol");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_PROTOCOL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-dscp");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_DSCP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-precedence");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_PRECEDENCE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-ecn");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_ECN;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-frag");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_FRAG;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-hdr-error");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_HDR_ERROR;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-options");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_OPTIONS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-cw");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_CW;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cw-exist");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CW_EXIST;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("gal-exist");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_GAL_EXIST;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ral-exist");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_RAL_EXIST;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        } \
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-pkt-len-range");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_PKT_LEN_RANGE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-ttl");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_TTL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("arp-op-code");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ARP_OP_CODE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("arp-protocol-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ARP_PROTOCOL_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("arp-sender-ip");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ARP_SENDER_IP;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV4_ADDRESS("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_IPV4_ADDRESS("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("arp-target-ip");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ARP_TARGET_IP;\
        if(is_add)\
        {\
            CTC_CLI_GET_IPV4_ADDRESS("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_IPV4_ADDRESS("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("rarp");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_RARP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-dst-port");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_DST_PORT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-src-port");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_SRC_PORT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-src-port-range");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_SRC_PORT_RANGE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l4-dst-port-range");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_L4_DST_PORT_RANGE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("tcp-ecn");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TCP_ECN;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("tcp-op");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TCP_OPTIONS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("tcp-flags");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TCP_FLAGS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("gre-key");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_GRE_KEY;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("gre-flags");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_GRE_FLAGS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("gre-protocol");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_GRE_PROTOCOL_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nvgre-key");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NVGRE_KEY;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vn-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VN_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-flags");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VXLAN_FLAGS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-rsv1");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VXLAN_RSV1;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("vxlan-rsv1", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-rsv2");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VXLAN_RSV2;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("vxlan-rsv2", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("icmp-code");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ICMP_CODE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("icmp-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ICMP_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("igmp-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IGMP_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("label-num");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_LABEL_NUM;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label0");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL0;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-exp0");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_EXP0;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-sbit0");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_SBIT0;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-ttl0");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_TTL0;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label1");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL1;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-exp1");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_EXP1;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-sbit1");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_SBIT1;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-ttl1");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_TTL1;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label2");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL2;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-exp2");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_EXP2;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-sbit2");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_SBIT2;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-ttl2");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_TTL2;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label3");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL3;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label4");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL4;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label5");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL5;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label6");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL6;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-label7");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_LABEL7;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ip-over-mpls");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IP_OVER_MPLS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-over-mpls");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPV6_OVER_MPLS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-fwd-label");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_FWD_LABEL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-fwd-exp");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_FWD_EXP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-fwd-sbit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_FWD_SBIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-fwd-ttl");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MPLS_FWD_TTL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-im-flow-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NPM_IM_FLOW_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("npm-im-l-flag");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NPM_IM_L_FLAG;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("npm-im-d-flag");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NPM_IM_D_FLAG;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-cbit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_CBIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-obit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_OBIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-next-protocol");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_NEXT_PROTOCOL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-si");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_SI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-spi");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_SPI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-terminal");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_NSH_TERMINAL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-y1731-oam");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IS_Y1731_OAM;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ether-oam-level");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ETHER_OAM_LEVEL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ether-oam-op-code");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ETHER_OAM_OP_CODE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ether-oam-version");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ETHER_OAM_VERSION;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("slow-protocol-code");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SLOW_PROTOCOL_CODE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("slow-protocol-flags");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SLOW_PROTOCOL_FLAGS;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("slow-protocol-sub-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SLOW_PROTOCOL_SUB_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ptp-message-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_PTP_MESSAGE_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ptp-version");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_PTP_VERSION;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("fcoe-dst-fcid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_FCOE_DST_FCID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("fcoe-src-fcid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_FCOE_SRC_FCID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("wlan-radio-mac");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_WLAN_RADIO_MAC;\
        if(is_add)\
        {\
            CTC_CLI_GET_MAC_ADDRESS("mac", wlan_radio_mac_addr, argv[index + 1]);\
            key_field->ext_data = wlan_radio_mac_addr; \
            if(index+2<argc){\
            CTC_CLI_GET_MAC_ADDRESS("mac-mask", wlan_radio_mac_addr_mask, argv[index + 2]);\
            key_field->ext_mask = wlan_radio_mac_addr_mask;} \
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("wlan-radio-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_WLAN_RADIO_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("wlan-ctl-pkt");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_WLAN_CTL_PKT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("satpdu-mef-oui");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SATPDU_MEF_OUI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("satpdu-oui-sub-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SATPDU_OUI_SUB_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ingress-nickname");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_INGRESS_NICKNAME;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("egress-nickname");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_EGRESS_NICKNAME;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-esadi");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IS_ESADI;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-trill-channel");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IS_TRILL_CHANNEL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-inner-vlanid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_INNER_VLANID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-inner-vlanid-valid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_INNER_VLANID_VALID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-key-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_KEY_TYPE;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-length");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_LENGTH;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-multihop");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_MULTIHOP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-multicast");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_MULTICAST;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-version");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_VERSION;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("trill-ttl");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_TRILL_TTL;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-category-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DST_CID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("src-category-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SRC_CID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index =  ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "udf-range", 0);\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_UDF_RANGE;\
        index = CTC_CLI_GET_ARGC_INDEX("udf-id");\
        if (INDEX_VALID(index))\
        {\
            CTC_CLI_GET_UINT32("udf-id", udf_data.udf_id, argv[index + 1]);         \
        }\
        else\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("udf-ad-id");\
            if (INDEX_VALID(index))\
            {\
                udf_ad_id_index = index;\
                CTC_CLI_GET_UINT32("udf-ad-id", udf_data.udf_ad_id, argv[index + 1]);         \
            }\
        }\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("sel-id");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("sel id", udf_data.sel_id, argv[index + 1]);         \
            }\
            index = CTC_CLI_GET_ARGC_INDEX("mask");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("mask", udf_data.mask, argv[index + 1]);         \
                 CTC_CLI_GET_UINT16("min", udf_data.min, argv[index + 2]);\
                 if(index+3<argc) CTC_CLI_GET_UINT16("max", udf_data.max, argv[index + 3]);\
            }\
            key_field->ext_data = &udf_data;\
            key_field->ext_mask = &udf_data_mask;\
        }\
        arg;\
    }\
    index =  ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "sudf-range", 0);\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SUDF_RANGE;\
        index = CTC_CLI_GET_ARGC_INDEX("sudf-id");\
        if (INDEX_VALID(index))\
        {\
            CTC_CLI_GET_UINT32("sudf-id", udf_data.udf_id, argv[index + 1]);         \
        }\
        else\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("sudf-ad-id");\
            if (INDEX_VALID(index))\
            {\
                sudf_ad_id_index = index;\
                CTC_CLI_GET_UINT32("sudf-ad-id", udf_data.udf_ad_id, argv[index + 1]);         \
            }\
        }\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("sel-id");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("sel id", udf_data.sel_id, argv[index + 1]);         \
            }\
            index = CTC_CLI_GET_ARGC_INDEX("mask");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("mask", udf_data.mask, argv[index + 1]);         \
                 CTC_CLI_GET_UINT16("min", udf_data.min, argv[index + 2]);\
                 if(index+3<argc) CTC_CLI_GET_UINT16("max", udf_data.max, argv[index + 3]);\
            }\
            key_field->ext_data = &udf_data;\
            key_field->ext_mask = &udf_data_mask;\
        }\
        arg;\
    }\
    index = ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "udf-ad-id", 0);\
    if (0xFF != index && udf_ad_id_index != index) \
    {\
        key_field->type = CTC_FIELD_KEY_UDF_AD_ID;\
        CTC_CLI_GET_UINT32("udf-ad-id", udf_data.udf_ad_id, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("udf-data");\
        if (INDEX_VALID(index))\
        {\
                CTC_CLI_GET_STR_DATA(udf_data.udf, udf_data_mask.udf, 1);\
        }\
        key_field->ext_data = &udf_data;\
        key_field->ext_mask = &udf_data_mask;\
        arg;\
    }\
    index = ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "sudf-ad-id", 0);\
    if (0xFF != index && sudf_ad_id_index != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SUDF_AD_ID;\
        CTC_CLI_GET_UINT32("udf-ad-id", sudf_data.udf_ad_id, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("udf-data");\
        if (INDEX_VALID(index))\
        {\
                CTC_CLI_GET_STR_DATA(sudf_data.udf, sudf_data_mask.udf, 1);\
        }\
        key_field->ext_data = &sudf_data;\
        key_field->ext_mask = &sudf_data_mask;\
        arg;\
    }\
    index = ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "udf", 0);\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_UDF;\
        index = CTC_CLI_GET_ARGC_INDEX("udf-id");\
        if (INDEX_VALID(index))\
        {\
            CTC_CLI_GET_UINT32("udf-id", udf_data.udf_id, argv[index + 1]);         \
        }\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("udf-data");\
            if (INDEX_VALID(index))\
            {\
                CTC_CLI_GET_STR_DATA(udf_data.udf, udf_data_mask.udf, 1);\
            }\
            key_field->ext_mask = &udf_data_mask;\
        }\
        key_field->ext_data = &udf_data;\
        arg;\
    }\
    index = ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "sudf", 0);\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_SUDF;\
        index = CTC_CLI_GET_ARGC_INDEX("udf-id");\
        if (INDEX_VALID(index))\
        {\
            CTC_CLI_GET_UINT32("udf-id", sudf_data.udf_id, argv[index + 1]);         \
        }\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("udf-data");\
            if (INDEX_VALID(index))\
            {\
                CTC_CLI_GET_STR_DATA(sudf_data.udf, sudf_data_mask.udf, 1);\
            }\
            key_field->ext_data = &sudf_data;\
            key_field->ext_mask = &sudf_data_mask;\
        }\
        arg;\
    }\
    index =  ctc_cli_get_prefix_item(&argv[start], (argc - (start)), "udf-range", 0);\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_UDF_RANGE;\
        index = CTC_CLI_GET_ARGC_INDEX("udf-id");\
        if (INDEX_VALID(index))\
        {\
            CTC_CLI_GET_UINT32("udf-id", udf_data.udf_id, argv[index + 1]);         \
        }\
        if(is_add)\
        {\
            index = CTC_CLI_GET_ARGC_INDEX("sel-id");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("sel id", udf_data.sel_id, argv[index + 1]);         \
            }\
            index = CTC_CLI_GET_ARGC_INDEX("mask");\
            if (INDEX_VALID(index))\
            {\
                 CTC_CLI_GET_UINT16("mask", udf_data.mask, argv[index + 1]);         \
                 CTC_CLI_GET_UINT16("min", udf_data.min, argv[index + 2]);\
                 if(index+3<argc) CTC_CLI_GET_UINT16("max", udf_data.max, argv[index + 3]);\
            }\
            key_field->ext_data = &udf_data;\
            key_field->ext_mask = &udf_data_mask;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("decap");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DECAP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("encap");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ENCAP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("elephant-pkt");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ELEPHANT_PKT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-pkt");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VXLAN_PKT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("int-pkt");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_INT_PKT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("routed-pkt");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_ROUTED_PKT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("pkt-fwd-type");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_PKT_FWD_TYPE; \
        CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
        if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macsa-lkup");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MACSA_LKUP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macsa-hit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MACSA_HIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macda-lkup");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MACDA_LKUP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macda-hit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_MACDA_HIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipsa-lkup");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPSA_LKUP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipsa-hit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPSA_HIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipda-lkup");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPDA_LKUP;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipda-hit");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_IPDA_HIT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DISCARD;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if((index+2<argc) && (index+2 != CTC_CLI_GET_ARGC_INDEX("discard-type"))) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
            index = CTC_CLI_GET_ARGC_INDEX("discard-type");\
            if (0xFF != index) \
            {\
                    CTC_CLI_GET_UINT32("discard-type", discard_type, argv[index + 1]);\
                    key_field->ext_data = &discard_type;\
            }\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cpu-reason-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CPU_REASON_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
            index = CTC_CLI_GET_ARGC_INDEX("is-acl-match-group");\
            if (0xFF != index) \
            {\
                key_field->ext_data = &(key_field->data);\
            }\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-gport");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DST_GPORT;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-nhid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DST_NHID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-nh-offset");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_DST_NHID;\
        key_field->data = 0;\
        key_field->mask = 0;\
        key_field->ext_data = &dsnh_offset; \
        key_field->ext_mask = &dsnh_offset_mask; \
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", dsnh_offset, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", dsnh_offset_mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("interface-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_INTERFACE_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vrfid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_VRFID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("metadata");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_METADATA;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("customer-id");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_CUSTOMER_ID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("hash-valid");\
    if (0xFF != index) \
    {\
        key_field->type = CTC_FIELD_KEY_HASH_VALID;\
        if(is_add)\
        {\
            CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("field-port");\
    if(0xFF != index)\
    {\
        uint8 _index_temp_ = index;\
        key_field->type = CTC_FIELD_KEY_PORT;\
        index = CTC_CLI_GET_ARGC_INDEX("port-class");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_PORT_CLASS;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT16("value", port_info.port_class_id, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT16("mask", port_info_mask.port_class_id, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("vlan-class");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_VLAN_CLASS;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT16("value", port_info.vlan_class_id, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT16("mask", port_info_mask.vlan_class_id, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("l3if-class");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_L3IF_CLASS;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT16("value", port_info.l3if_class_id, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT16("mask", port_info_mask.l3if_class_id, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("pbr-class");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_PBR_CLASS;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT8("value", port_info.pbr_class_id, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT8("mask", port_info_mask.pbr_class_id, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("gport");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_GPORT;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", port_info.gport, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", port_info_mask.gport, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("logic-port");\
        if (0xFF != index) \
        { \
            port_info.type = CTC_FIELD_PORT_TYPE_LOGIC_PORT;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT16("value", port_info.logic_port, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT16("mask", port_info_mask.logic_port, argv[index + 2]);\
                key_field->ext_mask = &port_info_mask;\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("port-bitmap");\
        if(INDEX_VALID(index) && index > _index_temp_)\
        {\
            port_info.type = CTC_FIELD_PORT_TYPE_PORT_BITMAP;\
            if (is_add)\
            {\
                CTC_CLI_GET_UINT8("lchip", port_info.lchip, argv[index + 1]);\
                CTC_CLI_GET_UINT32("port-bitmap 3", pbmp[3], argv[index + 2]);\
                CTC_CLI_GET_UINT32("port-bitmap 2", pbmp[2], argv[index + 3]);\
                CTC_CLI_GET_UINT32("port-bitmap 1", pbmp[1], argv[index + 4]);\
                CTC_CLI_GET_UINT32("port-bitmap 0", pbmp[0], argv[index + 5]);\
                cli_acl_port_bitmap_mapping(port_info.port_bitmap, pbmp);\
            }\
            key_field->ext_data = &port_info;\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pbm-list");\
        if(INDEX_VALID(index))\
        {\
            uint32 arr_num  = CTC_PORT_BITMAP_IN_WORD;\
            port_info.type = CTC_FIELD_PORT_TYPE_PORT_BITMAP;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT8("lchip", port_info.lchip, argv[index + 1]);\
                ctc_cmd_get_value_array("pbm list", argv[index + 2], port_info.port_bitmap, &arr_num, 2); \
            }\
            key_field->ext_data = &port_info;\
            arg;\
        }\
    } else {\
        index = CTC_CLI_GET_ARGC_INDEX("port-bitmap");\
        if(0xFF != index)\
        {\
            uint32 arr_num  = CTC_PORT_BITMAP_IN_WORD;\
            key_field->type = CTC_FIELD_KEY_PORT_BITMAP;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT8("lchip", key_field->data, argv[index + 1]);\
                ctc_cmd_get_value_array("port bitmap list", argv[index + 2], (void*)port_info.port_bitmap, &arr_num, 2); \
            }\
            key_field->ext_data = (void*)port_info.port_bitmap;\
            arg;\
        }\
    }\
       index = CTC_CLI_GET_ARGC_INDEX("arp-sender-mac");\
       if (0xFF != index) \
       {\
           key_field->type = CTC_FIELD_KEY_SENDER_MAC;\
           if(is_add)\
           {\
               CTC_CLI_GET_MAC_ADDRESS("arp-sender-mac", arp_sender_mac_addr, argv[index + 1]);\
               key_field->ext_data = arp_sender_mac_addr; \
               if(index+2<argc){\
               CTC_CLI_GET_MAC_ADDRESS("arp-sender-mac-mask", arp_sender_mac_addr_mask, argv[index + 2]);\
               key_field->ext_mask = arp_sender_mac_addr_mask;} \
            }\
            arg;\
        }\
       index = CTC_CLI_GET_ARGC_INDEX("arp-target-mac");\
       if (0xFF != index) \
       {\
           key_field->type = CTC_FIELD_KEY_TARGET_MAC;\
           if(is_add)\
           {\
               CTC_CLI_GET_MAC_ADDRESS("arp-target-mac", arp_target_mac_addr, argv[index + 1]);\
                key_field->ext_data = arp_target_mac_addr; \
                if(index+2<argc){\
                CTC_CLI_GET_MAC_ADDRESS("arp-target-mac-mask", arp_target_mac_addr_mask, argv[index + 2]);\
                key_field->ext_mask = arp_target_mac_addr_mask;} \
           }\
        arg;\
       }\
           index = CTC_CLI_GET_ARGC_INDEX("aware-tunnel-info");\
       if (0xFF != index) \
       {\
           if(is_add)\
           {\
           index = CTC_CLI_GET_ARGC_INDEX("vnid");\
           if (0xFF != index) \
           { \
            tunnel_data.type = 1;\
            CTC_CLI_GET_UINT32("vxlan-vni", tunnel_data.vxlan_vni, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("vxlan-vni-mask", tunnel_data_mask.vxlan_vni, argv[index + 2]);\
           } \
           index = CTC_CLI_GET_ARGC_INDEX("grekey");\
         if (0xFF != index) \
           { \
            tunnel_data.type = 2;\
            CTC_CLI_GET_UINT32("gre-key", tunnel_data.gre_key, argv[index + 1]);\
            if(index+2<argc) CTC_CLI_GET_UINT32("gre-key-mask", tunnel_data_mask.gre_key, argv[index + 2]);\
           } \
            index = CTC_CLI_GET_ARGC_INDEX("radio-mac");\
         if (0xFF != index) \
            { \
                 tunnel_data.type = 3;\
                 CTC_CLI_GET_MAC_ADDRESS("radio-mac", tunnel_data.radio_mac, argv[index + 1]);\
                 CTC_CLI_GET_MAC_ADDRESS("radio-mac-mask", tunnel_data_mask.radio_mac, argv[index + 2]);\
             } \
              index = CTC_CLI_GET_ARGC_INDEX("radio-id");\
         if (0xFF != index) \
        { \
            tunnel_data.type = 3;\
            CTC_CLI_GET_UINT8("radio-id", tunnel_data.radio_id, argv[index + 1]);\
            CTC_CLI_GET_UINT8("radio-id-mask", tunnel_data_mask.radio_id, argv[index + 2]);\
        } \
            index = CTC_CLI_GET_ARGC_INDEX("ctl-pkt");\
        if (0xFF != index) \
        { \
            tunnel_data.type = 3;\
            CTC_CLI_GET_UINT8("wlan-ctl-pkt", tunnel_data.wlan_ctl_pkt, argv[index + 1]);\
            CTC_CLI_GET_UINT8("wlan-ctl-pkt-mask", tunnel_data_mask.wlan_ctl_pkt, argv[index + 2]);\
        } \
        } \
            key_field->type = CTC_FIELD_KEY_AWARE_TUNNEL_INFO;\
            key_field->ext_data = &tunnel_data; \
            key_field->ext_mask = &tunnel_data_mask; \
            arg;\
      }\
         index = CTC_CLI_GET_ARGC_INDEX("stp-state");\
         if (0xFF != index) \
        {\
          key_field->type = CTC_FIELD_KEY_STP_STATE;\
          if(is_add)\
          {\
        CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
        if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
            arg;\
         }\
         index = CTC_CLI_GET_ARGC_INDEX("arp-mac-da-chk-fail");\
         if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_ARP_MAC_DA_CHK_FAIL;\
         if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                 if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
              }\
              arg;\
         }\
          index = CTC_CLI_GET_ARGC_INDEX("arp-mac-sa-chk-fail");\
          if (0xFF != index) \
          {\
               key_field->type = CTC_FIELD_KEY_ARP_MAC_SA_CHK_FAIL;\
           if(is_add)\
                {\
                    CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                     if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
             arg;\
           }\
           index = CTC_CLI_GET_ARGC_INDEX("arp-senderip-chk-fail");\
           if (0xFF != index) \
           {\
               key_field->type = CTC_FIELD_KEY_ARP_SENDERIP_CHK_FAIL;\
          if(is_add)\
              {\
                CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
               }\
          arg;\
            }\
          index = CTC_CLI_GET_ARGC_INDEX("arp-targetip-chk-fail");\
          if (0xFF != index) \
           {\
                key_field->type = CTC_FIELD_KEY_ARP_TARGETIP_CHK_FAIL;\
           if(is_add)\
                {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
                arg;\
             }\
          index = CTC_CLI_GET_ARGC_INDEX("garp");\
          if (0xFF != index) \
          {\
               key_field->type = CTC_FIELD_KEY_GARP;\
               if(is_add)\
                {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
               arg;\
           }\
          index = CTC_CLI_GET_ARGC_INDEX("is-arp-pkt");\
          if (0xFF != index) \
          {\
               key_field->type = CTC_FIELD_KEY_IS_ARP_PKT;\
               if(is_add)\
                {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
               arg;\
           }\
          index = CTC_CLI_GET_ARGC_INDEX("is-log-pkt");\
          if (0xFF != index) \
          {\
               key_field->type = CTC_FIELD_KEY_IS_LOG_PKT;\
                if(is_add)\
                {\
                    CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                    if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
               arg;\
           }\
           index = CTC_CLI_GET_ARGC_INDEX("satpdu-pdu-byte");\
           if (0xFF != index) \
           {\
               key_field->type = CTC_FIELD_KEY_SATPDU_PDU_BYTE;\
               if(is_add)\
                 {\
                    uint32 data_num = 0;\
                data_num = sal_sscanf(argv[index+1], "0x%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", \
                                (uint8*)data8, (uint8*)data8+1, (uint8*)data8+2, (uint8*)data8+3, (uint8*)data8+4, (uint8*)data8+5, (uint8*)data8+6, (uint8*)data8+7);\
                if (data_num != 8) {ctc_cli_out("  %%  Get SAT PDU data fail! \n");\
                    return CLI_ERROR;};\
                data_num = sal_sscanf(argv[index+2], "0x%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",\
                    (uint8*)mask8, (uint8*)mask8+1, (uint8*)mask8+2, (uint8*)mask8+3, (uint8*)mask8+4, (uint8*)mask8+5, (uint8*)mask8+6, (uint8*)mask8+7);\
                if (data_num != 8) {ctc_cli_out("  %%  Get SAT PDU mask fail! \n");\
                    return CLI_ERROR;}\
                      key_field->ext_data = (void*)data8;\
                      key_field->ext_mask = (void*)mask8;\
                 }\
               arg;\
             }\
          index = CTC_CLI_GET_ARGC_INDEX("l2-station-move");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_L2_STATION_MOVE;\
              if(is_add)\
              {\
                 CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                 if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
               }\
              arg;\
          }\
           index = CTC_CLI_GET_ARGC_INDEX("mac-security-discard");\
           if (0xFF != index) \
           {\
               key_field->type = CTC_FIELD_KEY_MAC_SECURITY_DISCARD;\
               if(is_add)\
               {\
                   CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                   if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                }\
                arg;\
            }\
            index = CTC_CLI_GET_ARGC_INDEX("dot1ae-es");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_ES;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-sc");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_SC;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-sl");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_SL;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-pn");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_PN;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-an");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_AN;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-sci");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_SCI;\
             if(is_add)\
                  {\
                    uint32 data_num = 0;\
                data_num = sal_sscanf(argv[index+1], "0x%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", \
                                (uint8*)data8, (uint8*)data8+1, (uint8*)data8+2, (uint8*)data8+3, (uint8*)data8+4, (uint8*)data8+5, (uint8*)data8+6, (uint8*)data8+7);\
                if (data_num != 8) {ctc_cli_out("  %%  Get SCI data fail! \n");\
                    return CLI_ERROR;};\
                data_num = sal_sscanf(argv[index+2], "0x%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",\
                    (uint8*)mask8, (uint8*)mask8+1, (uint8*)mask8+2, (uint8*)mask8+3, (uint8*)mask8+4, (uint8*)mask8+5, (uint8*)mask8+6, (uint8*)mask8+7);\
                if (data_num != 8) {ctc_cli_out("  %%  Get SCI mask fail! \n");\
                    return CLI_ERROR;}\
                      key_field->ext_data = (void*)data8;\
                      key_field->ext_mask = (void*)mask8;\
                 }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-unknow-pkt");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_UNKNOW_PKT;\
              if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-cbit");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_CBIT;\
              if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-ebit");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_EBIT;\
              if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-scb");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_SCB;\
              if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("dot1ae-ver");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_DOT1AE_VER;\
              if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("is-mcast-rpf-chk-fail");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_MCAST_RPF_CHECK_FAIL;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("udf-entry-valid");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_UDF_ENTRY_VALID;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("is-route-mac");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_IS_ROUTER_MAC;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("inner-is-route-mac");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_INNER_IS_RTMAC;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("gem-port");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_GEM_PORT;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
          index = CTC_CLI_GET_ARGC_INDEX("class-id");\
          if (0xFF != index) \
          {\
              key_field->type = CTC_FIELD_KEY_CLASS_ID;\
             if(is_add)\
                  {\
                      CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                      if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
                  }\
              arg;\
          }\
        index = CTC_CLI_GET_ARGC_INDEX("arp-hardware-type");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_ARP_HARDWARE_TYPE;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("arp-protocol-addlen");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_ARP_PROTOCOL_ADDLEN;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("arp-hardware-addlen");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_ARP_HARDWARE_ADDLEN;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-svlan-id");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_SVLAN_ID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-svlan-cfi");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_SVLAN_CFI;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-svlan-cos");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_SVLAN_COS;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-cvlan-id");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_CVLAN_ID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-cvlan-cfi");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_CVLAN_CFI;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-cvlan-cos");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_CVLAN_COS;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("port-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_PORT_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("vlan-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_VLAN_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("l3if-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_L3IF_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("scl-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SCL_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("tunnel-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_TUNNEL_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("flow-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_FLOW_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("forward-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_FID_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("nexthop-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_NEXTHOP_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("ldp-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_LDP_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("logic-src-port");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_LOGIC_SRC_PORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("priority");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_PRIORITY;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("color");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_COLOR;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("ral-exist");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_RAL_EXIST;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("gal-exist");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_GAL_EXIST;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("cw-exist");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_CW_EXIST;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("fid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_FID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-hdr-exist");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_HDR_EXIST;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           index = CTC_CLI_GET_ARGC_INDEX("hdr-type-bmp");\
           if (0xFF != index) \
           {\
           CTC_CLI_GET_UINT32("value", stk_hdr_type_data, argv[index + 1]);\
           if(index+2<argc) CTC_CLI_GET_UINT32("mask", stk_hdr_type_mask, argv[index + 2]);\
           key_field->ext_data = &stk_hdr_type_data;\
           key_field->ext_mask = &stk_hdr_type_mask;\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-dst-gport");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_DST_GPORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-src-gport");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_SRC_GPORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-logic-src-port");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_LOGIC_SRC_PORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-priority");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_PRIORITY;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-src-cid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_SRC_CID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-mirror-pkt");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_MIRROR_PKT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-lkup");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_LKUP;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("stk-fid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_STK_FID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-stag-valid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_STAG_VALID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("pi-ctag-valid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MAPPED_CTAG_VALID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("presel-entry-valid");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_PRESEL_ENTRY_VALID;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("mirror-pkt");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MIRROR_PKT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-type");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_TYPE;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-len");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_LEN;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-ver");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_VER;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-ebit");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_EBIT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-mbit");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_MBIT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-hop-ml");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_HOP_ML;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-remain-hop-cnt");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_REMAIN_HOP_CNT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("int-instruction");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_INT_INSTRUCTION;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("src-gport");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRC_GPORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-flag");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_FLAG;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-nh");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_NH;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-rt");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_RT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-sl");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_SL;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-le");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_LE;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("ether-type-ext");\
        if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_ETHER_TYPE;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", udf_ext_data, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", udf_ext_mask, argv[index + 2]);\
                key_field->ext_data = &udf_ext_data;\
                key_field->ext_mask = &udf_ext_mask;\
            }\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("srv6-srh-tag");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SRV6_SRH_TAG;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("sniffing-pkt");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_SNIFFING_PKT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT8("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT8("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("mark-ecn");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_MARK_ECN;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("congest-event");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_CONGEST_EVENT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("burst-event");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_BURST_EVENT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("lport");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_LPORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("logic-dst-port");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_LOGIC_DST_PORT;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("nat-iftype");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_NAT_IFTYPE;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("xdata");\
        if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_XDATA;\
            if(is_add)\
            {\
                xdata.num = ctc_cmd_get_map_array(1,(void*) (xdata_field),argv[index+2]);\
                xdata.fields = xdata_field;\
            }\
            key_field->ext_data = &xdata;\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("len-error");\
        if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_LEN_ERROR;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
            }\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("l4-hdr-error");\
        if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_L4_HDR_ERROR;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
            }\
            key_field->ext_data = &xdata;\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("to-stk");\
        if (0xFF != index) \
        {\
            key_field->type = CTC_FIELD_KEY_TO_STK;\
            if(is_add)\
            {\
                CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
                if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
            }\
            arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("route-data");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_ROUTE_DATA;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("bfd-my-disc");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_BFD_MY_DISC;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("bfd-your-disc");\
        if (0xFF != index) \
        {\
           key_field->type = CTC_FIELD_KEY_BFD_YOUR_DISC;\
           if(is_add)\
           {\
               CTC_CLI_GET_UINT32("value", key_field->data, argv[index + 1]);\
               if(index+2<argc) CTC_CLI_GET_UINT32("mask", key_field->mask, argv[index + 2]);\
           }\
           arg;\
        }\
}while(0)


#define CTC_CLI_ACL_ADD_FIELD_ACTION_STR "\
    | deny-bridge \
    | deny-learning \
    | deny-route  \
    | stats STATS-ID (not-care-discard | )\
    | random-log SESSION-ID LOG-PERCENT (log-id LOG_ID|)\
    | color COLOR {all|green|yellow|red|}\
    | dscp DSCP {dscp-color COLOR|}\
    | micro-flow-policer POLICER-ID \
    | macro-flow-policer POLICER-ID \
    | cos-hbwp-policer POLICER-ID COS-INDEX \
    | copp POLICER-ID  \
    | (src-cid|dst-cid) CID \
    | truncate-len LENGTH \
    | redirect NHID (without-dstmap|only-change-destmap|)\
    | redirect-port GPORT (only-change-destmap|)\
    | redirect-cancel-pkt-edit\
    | redirect-filter-routed-pkt \
    | discard {all|green|yellow|red|}\
    | cancel-discard{all|green|yellow|red|} \
    | priority (all |green|red|yellow)NEW-PRIORITY\
    | disable-elephant \
    | terminate-cid-hdr \
    | cancel-nat \
    | inter-cn NEW-INTER-CN {all|green|yellow|red|} \
    | disable-ipfix  \
    | deny-ipfix-learning  \
    | replace-lb-hash LB_HASH mode MODE (bmp BITMAP|)\
    | cancel-dot1ae \
    | ecn ECN\
    | dot1ae-permit-plain-pkt \
    | metadata METADATA \
    | enable-ipfix (cfg-profile-id PRO_ID field-sel SEL_ID hash-type HASH_TYPE{flex-key-en VALUE|use-mapped-vlan|use-cvlan|mfp POLICER_ID|sudf-en|lantency-en VALUE|cancel-learning|}|)\
    | ipfix-hash-salt-value Value \
    | vlan-edit (stag-op TAG_OP (svid-sl TAG_SL (new-svid VLAN_ID|)|) (scos-sl TAG_SL (new-scos COS|)|) (tpid-index TPID_INDEX|) (scfi-sl TAG_SL (new-scfi CFI|)|)|) \
     (ctag-op TAG_OP  (cvid-sl TAG_SL (new-cvid VLAN_ID|)|) (ccos-sl TAG_SL (new-ccos COS|)|) (ccfi-sl TAG_SL (new-ccfi CFI|)|)| )  \
    | strip-packet start-to TO_HEADER packet-type PKT_TYPE {extra-len EX_LEN|srv6-edit-en|} \
    | critical-pkt {critical-mode MODE|}\
    | cancel-acl-tcam-en ACL-PRIORITY (use-bitmap|)\
    | logic-port LOGIC_PORT \
    | oam (eth-oam | ip-bfd |flex|twamp) {dest-gchip GCHIP |dest-sliceid SLICE_ID | lmep-index MEP_INDEX | mip-en ENABLE | link-oam-en ENABLE | packet-offset PACKET_OFFSET | mac-da-check-en|is-self-address|time-stamp-en|timestamp-format FORMAT|twamp-reflect-en REFLECT_EN|gal-exist } \
    | cancel-all\
    | is-span-packet\
    | copy-to-cpu mode MODE {cpu-reason-id REASON|all|green|yellow| red | }  \
    | table-map-id TABLE_MAP_ID {cos2cos |cos2dscp | dscp2cos | dscp2dscp|} \
    | disable-ecmp-rr \
    | disable-ecmp-dlb \
    | disable-linkagg-rr \
    | lb-hash-ecmp-profile PROFILE_ID \
    | lb-hash-lag-profile PROFILE_ID \
    | lb-hash-profile PROFILE_ID \
    | vxlan-rsv-edit MODE {flags VALUE| reserved1 VALUE| reserved2 VALUE|} \
    | timestamp MODE \
    | reflective-bridge-en VALUE \
    | port-isolation-dis VALUE \
    | ext-timestamp-en VALUE \
    | int-log LOG_ID SESSION_TYPE \
    | ifa-session SESSION_ID \
    | service-id VALUE \
    | mpls-im-flow-id VALUE \
    | fp-id VALUE \
    | dot1ae-chan-id CHAN_ID (clear-tag-type TYPE|) \
    | dot1ae-spi SPI  \
    | cut-through \
    | fid VALUE\
    | nsh-edit EDIT_TYPE (nsh-id NSH_ID|)\
    | qdrop-monitor \
    | xdata profile PROFILE array-field MAP (igs-tcam| egs-tcam |igs-hash|) \
    "


#define CTC_CLI_ACL_ADD_FIELD_ACTION_DESC \
    "Deny bridge ", \
    "Deny learning ", \
    "Deny route ", \
    "Packet statistics ","Stats id" , "not care Discard pkt",\
    "Random log to cpu ","Session id" , "Log percent", "Log id", "Value", \
    "Change color ","Color(ctc_qos_color_t)", "All packet ","Green packet ","Yellow packet ","Red packet ",\
    "Dscp ","Dscp" , "Dscp-color", "Value", \
    "Micor flow policer ","Micro policer id" , \
    "Macor flow policer ","Macro policer id" , \
    "Cos hbwp policer ", "Hbwp policer id" , "Cos index" , \
    CTC_CLI_QOS_COPP, "Policer id", \
    "Source category id","Destination category id","Category id" ,\
    "Enable packet truncation", "Truncate length", \
    "Redirect packet ","Nexthop id" ,"Without dstmap" , "only change destmap",\
    "Redirect packet to single port ", CTC_CLI_GPORT_DESC,"only change destmap",\
    "Packet edit will be canceled for redirect packet",\
    "Filter Routed packet for redirect operation",\
    "Discard","Discard packet of all color ","Discard green packet","Discard yellow packet","Discard red packet",\
    "Cancel discard","Cancel discard packet of all color ", "Cancel discard green packet ", "Cancel discard yellow packet ","Cancel discard red packet ", \
    "New priority","All packet ","Green packet ","Yellow packet ","Red packet ","New priority" , \
    "Disable elephant flow ", \
    "Insert cid header to packet ", \
    "Cancel nat ", \
    "Internal CN ","Internal CN value", "all color ","green","yellow","red", \
    "Disable ipfix ", \
    "Disable ipfix learning ", \
    "Replace loadbalance hash value ","Hash value" ,\
    "Replace loadbalance mode ",\
    "Mode:0- linkagg hash;1- ecmp hash;2- linkagg and ecmp hash use same value;3- stacking hash", \
    "Bitmap",\
    "0;1;2;3(only support ecmp mode)", \
    "Cancel dot1ae encrypt", \
    "Ecn ","ecn value" , \
    "Dot1ae permit plain packet", \
    "Metedata ","metadata value" , \
    "Enable ipfix", "Profile id", "PROFILE ID", "Hash field select id", "SELECT ID", "Hash type", \
    CTC_CLI_IPFIX_HASH_TYPE_VALUE,"Flex key en", "value","Use mapped vlan","Use cvlan", "Mic flow policer", "Policer ID", "Sudf En", "Enable lantency", "value", "Cancel learning", \
    "ipfix hash salt value", "value",\
    "Vlan edit", \
    "Stag operation type", CTC_CLI_ACL_VLAN_TAG_OP_DESC, "Svid select", CTC_CLI_ACL_VLAN_TAG_SL_DESC, \
    "New stag vlan id", CTC_CLI_VLAN_RANGE_DESC, "Scos select", CTC_CLI_ACL_VLAN_TAG_SCOS_SL_DESC,  \
    "New stag cos", CTC_CLI_COS_RANGE_DESC, \
    "Set svlan tpid index", "Index, the corresponding svlan tpid is in EpeL2TpidCtl",\
    "Scfi select",  CTC_CLI_ACL_VLAN_TAG_SL_DESC, \
    "New stag cfi", "0-1", \
    "Ctag operation type", CTC_CLI_ACL_VLAN_TAG_OP_DESC, "Cvid select", CTC_CLI_ACL_VLAN_TAG_SL_DESC, \
    "New ctag vlan id",  CTC_CLI_VLAN_RANGE_DESC, "Ccos select", CTC_CLI_ACL_VLAN_TAG_SL_DESC, \
    "New ctag cos", CTC_CLI_COS_RANGE_DESC,  "Ccfi select",  CTC_CLI_ACL_VLAN_TAG_SL_DESC,  \
    "New ctag cfi", "0-1",   \
    "Strip packet", "Start to L2/L3/L4 header", "0:None, 1:L2, 2:L3, 3:L4", "Payload packet type", \
    "0:eth, 1:ipv4, 2:mpls, 3:ipv6",  "Extra-length",  "Unit: byte","Enable srv6 edit",\
    "Critical Packet", "Critical Mode", "MODE Value",\
    "Cancel ACL Tcam Lookup"," Data0: ACL Priority or ACL Priority bitmap", "use bmp",\
    "Logical port", "value",\
    "Enable OAM", "Oam type is Ether Oam ","Oam type is IP BFD ","Oam type is FLEX ","Oam type is TWAMP","Global Chip Id","Value","Slice Id","Value","Local Mep index","Value","MIP enable","Value","Link Oam or Section Oam","Value",\
    "Only used for bfd","Value","Mac da check enable", "Is-self-address","Time-stamp-enable","Timestamp format", "Format","twamp-reflect-en", " Value","gal-exist",\
    "Cancel all action",\
    "Is span packet",\
    "Copy to cpu","Mode","Value: 0 -not cover 1 -cover 2 -cancel copy to cpu","cpu reason id","value", "all color ","green","yellow","red",\
    CTC_CLI_QOS_TABLE_MAP_STR, CTC_CLI_QOS_TABLE_MAP_VALUE, "Cos2cos","Cos2dscp","Dscp2cos","Dscp2dscp", \
    "Disable ecmp rr mode", \
    "Disable ecmp dlb mode", \
    "Disable linkagg rr mode", \
    "Load hash select profile id for ecmp", "Profile id", \
    "Load hash select profile id for linkagg", "Profile id", \
    "Load hash select profile id for ecmp and linkagg", "Profile id", \
    "Vxlan reserved data edit mode", "0:None 1:Merge 2.Clear 3.Replace", \
    "Flags", "Value", \
    "Reserved1", "Value", \
    "Reserved2", "Value", \
    "Timestamp Mode", "Value", \
    "Reflective Bridge", "Value", \
    "Port Isolation Disable", "Value", \
    "Ext switch-id and timestamp", "Value", \
    "INT log", "Log id, or instruction bitmap", "Session type", \
    "IFA Session", "IFA Session ID ", \
    "Service id", "Value",\
    "Mpls IM flow id", "Value",\
    "FP id", "Value",\
    "Dot1ae Chan ID", "Channel ID", "Sectag ffset type","Type",\
    "Dot1ae Spi", "Spi Value",\
    "Cut-through",\
    "Fid","Value", \
    "Nsh Edit", "Edit Type", "Nsh ID", "Nsh ID Value", \
    "Enable queue drop monitor",\
    "Xdata ","Profile","Profile Value","Field array of temp xdata value","Two-dimensional Array,array number is ctc_xdata_field_t,format is [[WIDTH ,OFFSET ,DATA ,MASK ,FLAG],[...]].For example,[[4,48,0xf],[4,52,0xf],[4,56,0xf],[4,60,0xf],[4,64,0xf]],MASK and FLAG is invalid","Ingress tcam","Egress tcam","Ingress hash"

#define CTC_CLI_ACL_ADD_FIELD_ACTION_SET(act_field, arg) \
do{\
    index = CTC_CLI_GET_ARGC_INDEX("deny-bridge");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_BRIDGE;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-learning");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_LEARNING;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-route");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_ROUTE;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stats");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_STATS;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        if( 0xFF != CTC_CLI_GET_ARGC_INDEX("not-care-discard"))\
        {\
             act_field->data1 = 1;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("random-log");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_RANDOM_LOG;\
        CTC_CLI_GET_UINT32("session-id", act_field->data0, argv[index + 1]);\
        CTC_CLI_GET_UINT32("log-percent", act_field->data1, argv[index + 2]);\
        index = CTC_CLI_GET_ARGC_INDEX("log-id");\
        if (0xFF != index) \
        {\
            CTC_CLI_GET_UINT8("log-id",rand_log.log_id, argv[index + 1]);\
            rand_log.session_id = act_field->data0;\
            rand_log.percent = act_field->data1;\
            act_field->ext_data = &rand_log;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("color");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COLOR;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(act_field->data1, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(act_field->data1, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(act_field->data1, CTC_QOS_COLOR_YELLOW);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dscp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DSCP;\
        CTC_CLI_GET_UINT32("dscp", act_field->data0, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("dscp-color");\
        if (0xFF != index) \
        {\
            CTC_CLI_GET_UINT32("dscp color", act_field->data1, argv[index + 1]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("micro-flow-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_MICRO_FLOW_POLICER;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macro-flow-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_MACRO_FLOW_POLICER;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cos-hbwp-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COS_HBWP_POLICER;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 2]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("copp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COPP;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("src-cid");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SRC_CID;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-cid");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DEST_CID;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("truncate-len");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TRUNCATED_LEN;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("without-dstmap");\
        if (0xFF != index) \
        {\
            act_field->data1 = 1;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-port");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_PORT;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("only-change-destmap");\
        if (0xFF != index) \
        {\
           act_field->data1 = 1;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-cancel-pkt-edit");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_CANCEL_PKT_EDIT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-filter-routed-pkt");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_FILTER_ROUTED_PKT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard");\
    if (0xFF != index) \
    {\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_NONE;\
        }\
        act_field->type = CTC_ACL_FIELD_ACTION_DISCARD;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-discard");\
    if (0xFF != index) \
    {\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_NONE;\
        }\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_DISCARD;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("priority");\
    if (0xFF != index) \
    {\
    if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
    	{\
        act_field->type = CTC_ACL_FIELD_ACTION_PRIORITY;\
        act_field->data0 = CTC_QOS_COLOR_NONE;\
        CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 2]);\
        arg;\
         }\
    else if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PRIORITY;\
        act_field->data0 = CTC_QOS_COLOR_GREEN;\
        CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 2]);\
        arg;\
    }\
   else if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PRIORITY;\
        act_field->data0 = CTC_QOS_COLOR_RED;\
        CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 2]);\
        arg;\
    }\
   else if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PRIORITY;\
        act_field->data0 = CTC_QOS_COLOR_YELLOW;\
        CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 2]);\
        arg;\
    }\
	}\
    index = CTC_CLI_GET_ARGC_INDEX("disable-elephant");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ELEPHANT_LOG;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("terminate-cid-hdr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TERMINATE_CID_HDR;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-nat");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_NAT;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("inter-cn");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_INTER_CN;\
        CTC_CLI_GET_UINT8("inter-cn", inter_cn.inter_cn, argv[index + 1]);\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(inter_cn.color, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(inter_cn.color, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(inter_cn.color, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            inter_cn.color = CTC_QOS_COLOR_NONE;\
        }\
        act_field->ext_data = &inter_cn;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-ipfix");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_IPFIX;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-ipfix-learning");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_IPFIX_LEARNING;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("replace-lb-hash");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REPLACE_LB_HASH;\
        act_field->ext_data = &lb_hash;\
        CTC_CLI_GET_UINT8("lb_hash", lb_hash.lb_hash, argv[index + 1]);\
        CTC_CLI_GET_UINT8("mode", lb_hash.mode, argv[index + 3]);\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("bmp"))\
        {\
            CTC_CLI_GET_UINT32("bmp", act_field->data0, argv[index + 5]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-dot1ae");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_DOT1AE;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ecn");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_ECN;\
        CTC_CLI_GET_UINT8("ecn", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-permit-plain-pkt");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_PERMIT_PLAIN_PKT;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("metadata");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_METADATA;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("enable-ipfix"); \
    if (0xFF != index)  \
    {  \
        index = CTC_CLI_GET_ARGC_INDEX("cfg-profile-id");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("cfg-profile-id", ipfix.flow_cfg_id, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("field-sel");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("field-sel", ipfix.field_sel_id, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("hash-type");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("hash-type", ipfix.hash_type, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("flex-key-en");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("flex-key-en", ipfix.flex_key_en, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("use-mapped-vlan");\
        if (0xFF != index) \
        {   \
            ipfix.use_mapped_vlan = 1;    \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("use-cvlan");\
        if (0xFF != index) \
        {   \
            ipfix.use_cvlan = 1;    \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("mfp");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT32("mfp", ipfix.policer_id, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("sudf-en");\
        if (0xFF != index) \
        {   \
            ipfix.sudf_en = 1;         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("lantency-en");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("lantency-en", ipfix.lantency_en, argv[index + 1]);         \
        }   \
        index = CTC_CLI_GET_ARGC_INDEX("cancel-learning");\
        if (0xFF != index) \
        {   \
            ipfix.cancel_learning=1;         \
        }   \
        act_field->type = CTC_ACL_FIELD_ACTION_IPFIX;\
        act_field->ext_data = &ipfix;\
        arg;  \
    }  \
    index = CTC_CLI_GET_ARGC_INDEX("ipfix-hash-salt-value");\
    if (0xFF != index) \
    {   \
        CTC_CLI_GET_UINT16("hash-salt-value", act_field->data0, argv[index + 1]);         \
        act_field->type = CTC_ACL_FIELD_ACTION_IPFIX_HASH_SALT;\
        arg;  \
    } \
    index = CTC_CLI_GET_ARGC_INDEX("vlan-edit");                                            \
    if (INDEX_VALID(index))                                                                  \
    {                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("stag-op");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("stag-op", vlan_edit.stag_op, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("svid-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("svid-sl", vlan_edit.svid_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-svid");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT16("new-svid", vlan_edit.svid_new, argv[index + 1]);      \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("scos-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("scos-sl", vlan_edit.scos_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-scos");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("new-scos", vlan_edit.scos_new, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("scfi-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("scfi-sl", vlan_edit.scfi_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-scfi");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("new-scfi", vlan_edit.scfi_new, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("ctag-op");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("ctag-op", vlan_edit.ctag_op, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("cvid-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("cvid-sl", vlan_edit.cvid_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-cvid");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT16("new-cvid", vlan_edit.cvid_new, argv[index + 1]);      \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("ccos-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("ccos-sl", vlan_edit.ccos_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-ccos");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("new-ccos", vlan_edit.ccos_new, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("ccfi-sl");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("ccfi-sl", vlan_edit.ccfi_sl, argv[index + 1]);         \
        }                                                                                       \
        index = CTC_CLI_GET_ARGC_INDEX("new-ccfi");                                              \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("new-ccfi", vlan_edit.ccfi_new, argv[index + 1]);         \
        }                                                                                        \
        index = CTC_CLI_GET_ARGC_INDEX("tpid-index");                                            \
        if (INDEX_VALID(index))                                                                  \
        {                                                                                       \
            CTC_CLI_GET_UINT8("tpid-index", vlan_edit.tpid_index, argv[index + 1]);         \
        }                                                                                   \
        act_field->type = CTC_ACL_FIELD_ACTION_VLAN_EDIT;\
        act_field->ext_data = &vlan_edit;\
        arg;  \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("strip-packet");\
    if (0xFF != index) \
    {\
        index = CTC_CLI_GET_ARGC_INDEX("start-to");                               \
        if (INDEX_VALID(index))                                                             \
        {                                                                                   \
            CTC_CLI_GET_UINT8("start-to", packet_strip.start_packet_strip, argv[index + 1]);     \
        }                                                                               \
        index = CTC_CLI_GET_ARGC_INDEX("extra-len");                               \
        if (INDEX_VALID(index))                                                             \
        {                                                                                   \
            CTC_CLI_GET_UINT8("extra-len", packet_strip.strip_extra_len, argv[index + 1]);     \
        }                                                                               \
        index = CTC_CLI_GET_ARGC_INDEX("packet-type");                               \
        if (INDEX_VALID(index))                                                             \
        {                                                                                   \
            CTC_CLI_GET_UINT8("packet-type", packet_strip.packet_type, argv[index + 1]);     \
        }                                                                               \
        index = CTC_CLI_GET_ARGC_INDEX("srv6-edit-en");                               \
        if (INDEX_VALID(index))                                                             \
        {                                                                                   \
            packet_strip.srv6_edit_en = 1;     \
        }                                                                               \
        act_field->type = CTC_ACL_FIELD_ACTION_STRIP_PACKET;\
        act_field->ext_data = &packet_strip;\
        arg;\
    }\
         index = CTC_CLI_GET_ARGC_INDEX("critical-pkt");\
         if (0xFF != index) \
        {\
            act_field->type = CTC_ACL_FIELD_ACTION_CRITICAL_PKT;\
            index = CTC_CLI_GET_ARGC_INDEX("critical-mode");\
            if (INDEX_VALID(index)){\
                CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
            }\
            arg;\
         }\
          index = CTC_CLI_GET_ARGC_INDEX("cancel-acl-tcam-en");\
          if (0xFF != index) \
          {\
              act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_ACL_TCAM_EN;\
              CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
              if( 0xFF != CTC_CLI_GET_ARGC_INDEX("use-bitmap"))\
              {\
                   act_field->data1 = 1;\
              }\
              arg;\
           }\
           index = CTC_CLI_GET_ARGC_INDEX("logic-port");\
           if (0xFF != index) \
          {\
              act_field->type = CTC_ACL_FIELD_ACTION_LOGIC_PORT;\
               CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
               arg;\
           }\
    index = CTC_CLI_GET_ARGC_INDEX("oam");\
    if (0xFF != index) \
    {   \
        act_field->type = CTC_ACL_FIELD_ACTION_OAM;\
        index = CTC_CLI_GET_ARGC_INDEX("eth-oam");\
        if (0xFF != index) \
        { \
            oam_t.oam_type = CTC_ACL_OAM_TYPE_ETH_OAM;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("ip-bfd");\
        if (0xFF != index) \
        { \
            oam_t.oam_type = CTC_ACL_OAM_TYPE_IP_BFD;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("flex");\
        if (0xFF != index) \
        { \
            oam_t.oam_type = CTC_ACL_OAM_TYPE_FLEX;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("twamp");\
        if (0xFF != index) \
        { \
            oam_t.oam_type = CTC_ACL_OAM_TYPE_TWAMP;\
        } \
        index = CTC_CLI_GET_ARGC_INDEX("dest-gchip");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("dest-gchip", oam_t.dest_gchip, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("lmep-index");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT16("lmep-index", oam_t.lmep_index, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("mip-en");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("mip-en", oam_t.mip_en, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("mac-da-check-en");\
        if (0xFF != index) \
        {   \
            oam_t.mac_da_check_en = 1;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("is-self-address");\
        if (0xFF != index) \
        {   \
            oam_t.is_self_address = 1;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("time-stamp-en");\
        if (0xFF != index) \
        {   \
            oam_t.time_stamp_en = 1;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("timestamp-format");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("timestamp format", oam_t.timestamp_format, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("twamp-reflect-en");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("twamp-reflect-en", oam_t.twamp_reflect_en, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("gal-exist");\
        if (0xFF != index) \
        {   \
            oam_t.gal_exist = 1;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("link-oam-en");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("link-oam-en", oam_t.link_oam_en, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("packet-offset");\
        if (0xFF != index) \
        {   \
            CTC_CLI_GET_UINT8("packet-offset",oam_t.packet_offset, argv[index + 1]);\
        }\
        act_field->ext_data = &oam_t;\
        arg;\
     }  \
     index = CTC_CLI_GET_ARGC_INDEX("cancel-all");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_ALL;\
        act_field->data0 = 1;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-span-packet");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SPAN_FLOW;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("copy-to-cpu");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CP_TO_CPU;\
        index = CTC_CLI_GET_ARGC_INDEX("mode");\
        if (0xFF != index) \
        {\
            CTC_CLI_GET_UINT8("mode",cp_to_cpu.mode, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("cpu-reason-id");\
        if (0xFF != index) \
        {\
            CTC_CLI_GET_UINT16("cpu-reason-id",cp_to_cpu.cpu_reason_id, argv[index + 1]);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(cp_to_cpu.color, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(cp_to_cpu.color, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(cp_to_cpu.color, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            cp_to_cpu.color = CTC_QOS_COLOR_NONE;\
        }\
        act_field->ext_data = &cp_to_cpu;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("table-map-id");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_QOS_TABLE_MAP;\
        CTC_CLI_GET_UINT8("table-map-id", table_map.table_map_id, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("cos2cos");\
        if (0xFF != index)\
        {\
            table_map.table_map_type |= CTC_QOS_TABLE_MAP_IGS_COS_TO_COS;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("cos2dscp");\
        if (0xFF != index)\
        {\
            table_map.table_map_type |= CTC_QOS_TABLE_MAP_IGS_COS_TO_DSCP;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("dscp2cos");\
        if (0xFF != index)\
        {\
            table_map.table_map_type |= CTC_QOS_TABLE_MAP_IGS_DSCP_TO_COS;\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("dscp2dscp");\
        if (0xFF != index)\
        {\
            table_map.table_map_type |= CTC_QOS_TABLE_MAP_IGS_DSCP_TO_DSCP;\
        }\
        act_field->ext_data = &table_map;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-ecmp-rr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ECMP_RR;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("disable-ecmp-dlb");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ECMP_DLB;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("disable-linkagg-rr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_LINKAGG_RR;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-ecmp-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_ECMP_PROFILE;\
        CTC_CLI_GET_UINT8("lb-hash-ecmp-profile", act_field->data0, argv[index + 1]);\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-lag-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_LAG_PROFILE;\
        CTC_CLI_GET_UINT8("lb-hash-lag-profile", act_field->data0, argv[index + 1]);\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_PROFILE;\
        CTC_CLI_GET_UINT8("lb-hash-profile", act_field->data0, argv[index + 1]);\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-rsv-edit");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_VXLAN_RSV_EDIT;\
        CTC_CLI_GET_UINT8("vxlan-rsv-edit", vxlan_rsv_edit.edit_mode, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("flags");\
        if (0xFF != index)\
        {\
            CTC_CLI_GET_UINT8("flags", vxlan_rsv_edit.vxlan_flags, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("reserved1");\
        if (0xFF != index)\
        {\
            CTC_CLI_GET_UINT32("reserved1", vxlan_rsv_edit.vxlan_rsv1, argv[index + 1]);\
        }\
        index = CTC_CLI_GET_ARGC_INDEX("reserved2");\
        if (0xFF != index)\
        {\
            CTC_CLI_GET_UINT8("reserved2", vxlan_rsv_edit.vxlan_rsv2, argv[index + 1]);\
        }\
        act_field->ext_data = (void*)&vxlan_rsv_edit;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("timestamp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TIMESTAMP;\
        CTC_CLI_GET_UINT8("value", timestamp.mode, argv[index + 1]);\
        act_field->ext_data = (void*)&timestamp; \
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("reflective-bridge-en"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REFLECTIVE_BRIDGE_EN;\
        CTC_CLI_GET_UINT8("value", act_field->data0, argv[index + 1]);\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("port-isolation-dis"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PORT_ISOLATION_DIS;\
        CTC_CLI_GET_UINT8("value", act_field->data0, argv[index + 1]);\
        arg;\
    } \
	index = CTC_CLI_GET_ARGC_INDEX("ext-timestamp-en"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_EXT_TIMESTAMP;\
        CTC_CLI_GET_UINT8("value", act_field->data0, argv[index + 1]);\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("int-log"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_INT;\
        CTC_CLI_GET_UINT8("log id", acl_int.session_id, argv[index + 1]);\
        CTC_CLI_GET_UINT8("instruction bitmap", acl_int.instruction_bitmap, argv[index + 1]);\
        CTC_CLI_GET_UINT8("session type", acl_int.session_type, argv[index + 2]);\
        act_field->ext_data = (void*)&acl_int;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ifa-session"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_IFA;\
        CTC_CLI_GET_UINT8("session id", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("service-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SERVICE_ID;\
        CTC_CLI_GET_UINT16("service id", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls-im-flow-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_NPM_IM_FLOW_ID;\
        CTC_CLI_GET_UINT32("mpls-im-flow-id", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("fp-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_FPID;\
        CTC_CLI_GET_UINT16("fp-id", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-chan-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_CHAN_ID;\
        CTC_CLI_GET_UINT16("chan-id", act_field->data0, argv[index + 1]);\
        index = CTC_CLI_GET_ARGC_INDEX("clear-tag-type"); \
        if (0xFF != index) {\
            CTC_CLI_GET_UINT16("clear-tag-type", act_field->data1, argv[index + 1]);\
            act_field->ext_data = &act_field->data1;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-spi"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_SPI;\
        CTC_CLI_GET_UINT16("spi", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cut-through"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CUT_THROUGH;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("fid"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_FID;\
        CTC_CLI_GET_UINT16("value", act_field->data0, argv[index + 1]);\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-edit"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_NSH;\
        CTC_CLI_GET_UINT32("value", act_field->data0, argv[index + 1]);\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("nsh-id")) \
        {\
            CTC_CLI_GET_UINT32("value", act_field->data1, argv[index + 3]);\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("qdrop-monitor"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_QDROP_MONITOR;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("xdata"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_XDATA;\
        xdata.type = CTC_XDATA_PROF_TYPE_DSACL;\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("profile")) \
        {\
            CTC_CLI_GET_UINT32("value", xdata.prof_id, argv[index + 2]);\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("igs-tcam")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_DSACL;\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("egs-tcam")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_EGS_DSACL;\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("igs-hash")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_DSFLOW;\
        }\
        xdata.num = ctc_cmd_get_map_array(1,(void*) (xdata_field),argv[index+4]);\
        xdata.fields = xdata_field;\
        act_field->ext_data = &xdata;\
        arg;\
    } \
    }while(0)

#define CTC_CLI_ACL_REMOVE_FIELD_ACTION_STR "\
      deny-bridge \
    | deny-learning \
    | deny-route  \
    | stats  \
    | random-log \
    | color  \
    | dscp  \
    | micro-flow-policer \
    | macro-flow-policer \
    | cos-hbwp-policer \
    | copp \
    | (src-cid|dst-cid) \
    | truncate-len  \
    | redirect  \
    | redirect-port  \
    | redirect-cancel-pkt-edit\
    | redirect-filter-routed-pkt \
    | discard (all|green|yellow|red|)\
    | cancel-discard(all|green|yellow|red|) \
    | priority (all |green|red|yellow) \
    | disable-elephant \
    | terminate-cid-hdr \
    | cancel-nat \
    | inter-cn \
    | disable-ipfix  \
    | deny-ipfix-learning  \
    | replace-lb-hash  \
    | cancel-dot1ae \
    | ecn \
    | dot1ae-permit-plain-pkt \
    | metadata  \
    | enable-ipfix \
    | ipfix-hash-salt-value \
    | vlan-edit  \
    | strip-packet \
    | critical-pkt \
    | cancel-acl-tcam-en \
    | logic-port \
    | oam \
    | cancel-all\
    | is-span-packet\
    | copy-to-cpu \
    | table-map-id \
    | disable-ecmp-rr \
    | disable-ecmp-dlb \
    | disable-linkagg-rr \
    | lb-hash-ecmp-profile \
    | lb-hash-lag-profile \
    | lb-hash-profile \
    | vxlan-rsv-edit \
    | timestamp \
    | reflective-bridge-en \
    | port-isolation-dis \
    | ext-timestamp-en \
    | int-log \
    | ifa-session \
    | service-id \
    | mpls-im-flow-id \
    | fp-id \
    | dot1ae-chan-id \
    | dot1ae-spi \
    | cut-through \
    | fid \
    | nsh-edit \
    | qdrop-monitor \
    | xdata profile PROFILE array-field MAP (igs-tcam| egs-tcam |igs-hash|) \
    "

#define CTC_CLI_ACL_REMOVE_FIELD_ACTION_DESC \
    "Deny bridge ", \
    "Deny learning ", \
    "Deny route ", \
    "Packet statistics ", \
    "Random log to cpu ",\
    "Change color ", \
    "Dscp ", \
    "Micor flow policer ", \
    "Macor flow policer ", \
    "Cos hbwp policer", \
    CTC_CLI_QOS_COPP,  \
    "Source category id","Destination category id",\
    "Enable packet truncation", \
    "Redirect packet ", \
    "Redirect packet to single port ",\
    "Packet edit will be canceled for redirect packet",\
    "Filter Routed packet for redirect operation",\
    "Discard","Discard packet of all color ","Discard green packet","Discard yellow packet","Discard red packet",\
    "Cancel discard","Cancel discard packet of all color ", "Cancel discard green packet ", "Cancel discard yellow packet ","Cancel discard red packet ", \
    "New priority","All packet ","Green packet ","Yellow packet ","Red packet ", \
    "Disable elephant flow ", \
    "Terminate cid header to packet", \
    "Cancel nat ", \
    "Internal CN ", \
    "Disable ipfix ", \
    "Disable ipfix learning ", \
    "Replace loadbalance hash value ",\
    "Cancel dot1ae encrypt", \
    "Dot1ae permit plain packet", \
    "Metedata ", \
    "Enable ipfix",\
    "Ipfix hash salt value", \
    "Vlan edit", \
    "Strip packet", \
    "Critical Packet",\
    "Cancel ACL Tcam Lookup",\
    "Logical port", \
    "Enable OAM",\
    "Cancel all action",\
    "Is span packet",\
    "Copy to cpu",\
    CTC_CLI_QOS_TABLE_MAP_STR, \
    "Disable ecmp rr mode", \
    "Disable ecmp dlb mode", \
    "Disable linkagg rr mode", \
    "Load hash select profile id for ecmp", \
    "Load hash select profile id for linkagg", \
    "Load hash select profile id for ecmp and linkagg", \
    "Vxlan reserved edit mode", \
    "Timestamp Mode", \
    "Reflective Bridge", \
    "Port Isolation Disable", \
    "Ext timestamp en", \
    "Int log", \
    "Ifa Session", \
    "Service id",\
    "mpls inband oam flowid",\
    "Dot1ae Chan ID", \
    "Dot1ae Spi",\
    "Cut-through", \
    "Fid", \
    "Nsh edit", \
    "Enable queue drop monitor", \
    "Xdata ","Profile","Profile Value","Field array of temp xdata value","Two-dimensional Array,array number is ctc_xdata_field_t,format is [[WIDTH ,OFFSET ,DATA ,MASK ,FLAG],[...]].For example,[[4,48,0xf],[4,52,0xf],[4,56,0xf],[4,60,0xf],[4,64,0xf]],MASK and FLAG is invalid","Ingress tcam","Egress tcam","Ingress hash"


#define CTC_CLI_ACL_REMOVE_FIELD_ACTION_SET(act_field, arg) \
do{\
    index = CTC_CLI_GET_ARGC_INDEX("deny-bridge");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_BRIDGE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-learning");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_LEARNING;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-route");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DENY_ROUTE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("stats");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_STATS;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("random-log");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_RANDOM_LOG;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("color");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COLOR;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dscp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DSCP;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("micro-flow-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_MICRO_FLOW_POLICER;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("macro-flow-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_MACRO_FLOW_POLICER;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cos-hbwp-policer");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COS_HBWP_POLICER;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("copp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_COPP;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("src-cid");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SRC_CID;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dst-cid");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DEST_CID;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("truncate-len");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TRUNCATED_LEN;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-port");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_PORT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-cancel-pkt-edit");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_CANCEL_PKT_EDIT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("redirect-filter-routed-pkt");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REDIRECT_FILTER_ROUTED_PKT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("discard");\
    if (0xFF != index) \
    {\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_NONE;\
        }\
        act_field->type = CTC_ACL_FIELD_ACTION_DISCARD;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-discard");\
    if (0xFF != index) \
    {\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_GREEN);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_RED);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            CTC_BIT_SET(act_field->data0, CTC_QOS_COLOR_YELLOW);\
        }\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_NONE;\
        }\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_DISCARD;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("priority");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PRIORITY;\
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("all"))\
    	{\
            act_field->data0 = CTC_QOS_COLOR_NONE;\
         }\
        else if(0xFF != CTC_CLI_GET_ARGC_INDEX("green"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_GREEN;\
        }\
       else if(0xFF != CTC_CLI_GET_ARGC_INDEX("red"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_RED;\
        }\
       else if(0xFF != CTC_CLI_GET_ARGC_INDEX("yellow"))\
        {\
            act_field->data0 = CTC_QOS_COLOR_YELLOW;\
        }\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-elephant");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ELEPHANT_LOG;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("terminate-cid-hdr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TERMINATE_CID_HDR;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-nat");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_NAT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("inter-cn");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_INTER_CN;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-ipfix");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_IPFIX;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("deny-ipfix-learning");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_IPFIX_LEARNING;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("replace-lb-hash");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REPLACE_LB_HASH;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-dot1ae");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_DOT1AE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ecn");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_ECN;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-permit-plain-pkt");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_PERMIT_PLAIN_PKT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("metadata");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_METADATA;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("enable-ipfix"); \
    if (0xFF != index)  \
    {  \
        act_field->type = CTC_ACL_FIELD_ACTION_IPFIX;\
        arg;  \
    }  \
    index = CTC_CLI_GET_ARGC_INDEX("ipfix-hash-salt-value");\
    if (0xFF != index) \
    {   \
        act_field->type = CTC_ACL_FIELD_ACTION_IPFIX_HASH_SALT;\
        arg;  \
    } \
    index = CTC_CLI_GET_ARGC_INDEX("vlan-edit"); \
    if (INDEX_VALID(index))   \
    {  \
        act_field->type = CTC_ACL_FIELD_ACTION_VLAN_EDIT;\
        arg;  \
    }\
    index = CTC_CLI_GET_ARGC_INDEX("strip-packet");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_STRIP_PACKET;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("critical-pkt");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CRITICAL_PKT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("cancel-acl-tcam-en");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_ACL_TCAM_EN;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("logic-port");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LOGIC_PORT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("oam");\
    if (0xFF != index) \
    {   \
        act_field->type = CTC_ACL_FIELD_ACTION_OAM;\
        arg;\
    }  \
    index = CTC_CLI_GET_ARGC_INDEX("cancel-all");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CANCEL_ALL;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("is-span-packet");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SPAN_FLOW;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("copy-to-cpu");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CP_TO_CPU;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("table-map-id");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_QOS_TABLE_MAP;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-ecmp-rr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ECMP_RR;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-ecmp-dlb");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_ECMP_DLB;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("disable-linkagg-rr");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DISABLE_LINKAGG_RR;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-ecmp-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_ECMP_PROFILE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-lag-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_LAG_PROFILE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("lb-hash-profile");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_LB_HASH_PROFILE;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("vxlan-rsv-edit");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_VXLAN_RSV_EDIT;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("timestamp");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_TIMESTAMP;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("reflective-bridge-en"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_REFLECTIVE_BRIDGE_EN;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("port-isolation-dis"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_PORT_ISOLATION_DIS;\
        arg;\
    } \
	index = CTC_CLI_GET_ARGC_INDEX("ext-timestamp-en"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_EXT_TIMESTAMP;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("int-log"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_INT;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("ifa-session"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_IFA;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("service-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_SERVICE_ID;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("mpls-im-flow-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_NPM_IM_FLOW_ID;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("fp-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_FPID;\
        arg;\
    } \
     index = CTC_CLI_GET_ARGC_INDEX("dot1ae-chan-id"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_CHAN_ID;\
        arg;\
    } \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_SPI;\
        arg;\
    } \
    index = CTC_CLI_GET_ARGC_INDEX("cut-through"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_CUT_THROUGH;\
        arg;\
    } \
     index = CTC_CLI_GET_ARGC_INDEX("fid"); \
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_FID;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("nsh-edit");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_NSH;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("qdrop-monitor");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_QDROP_MONITOR;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("dot1ae-spi");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_DOT1AE_SPI;\
        arg;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("xdata");\
    if (0xFF != index) \
    {\
        act_field->type = CTC_ACL_FIELD_ACTION_XDATA;\
        xdata.type = CTC_XDATA_PROF_TYPE_DSACL;\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("profile")) \
        {\
            CTC_CLI_GET_UINT32("value", xdata.prof_id, argv[index + 2]);\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("igs-tcam")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_DSACL;\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("egs-tcam")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_EGS_DSACL;\
        }\
        if (0xFF != CTC_CLI_GET_ARGC_INDEX("igs-hash")) \
        {\
            xdata.type = CTC_XDATA_PROF_TYPE_DSFLOW;\
        }\
        xdata.num = ctc_cmd_get_map_array(1,(void*) (xdata_field),argv[index+4]);\
        xdata.fields = xdata_field;\
        act_field->ext_data = &xdata;\
        arg;\
    } \
}while(0);

#define CTC_CLI_ACL_HASH_KEY_TYPE_SET \
    index = CTC_CLI_GET_ARGC_INDEX("mac");\
    if (0xFF != index)\
    {\
        key_type = CTC_ACL_KEY_HASH_MAC;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv4");\
    if (0xFF != index)\
    {\
        key_type = CTC_ACL_KEY_HASH_IPV4;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("ipv6");\
    if (0xFF != index)\
    {\
        key_type = CTC_ACL_KEY_HASH_IPV6;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("l2l3");\
    if (0xFF != index)\
    {\
        key_type = CTC_ACL_KEY_HASH_L2_L3;\
    }\
    index = CTC_CLI_GET_ARGC_INDEX("mpls");\
    if (0xFF != index)\
    {\
        key_type = CTC_ACL_KEY_HASH_MPLS;\
    }

#define CTC_CLI_ACL_FLEX_KEY_STR    "\
mac-key | \
ipv4-key | \
mpls-key | \
ipv6-key | \
hash-mac-key | \
hash-ipv4-key | \
hash-l2-l3-key | \
hash-mpls-key | \
hash-ipv6-key | \
hash-nsh-key | \
pbr-ipv4-key | \
pbr-ipv6-key | \
ipv4-ext-key | \
mac-ipv4-key | \
mac-ipv4-ext-key | \
ipv6-ext-key | \
mac-ipv6-key | \
cid-key | \
interface-key | \
fwd-key | \
fwd-ext-key | \
copp-key | \
copp-ext-key | \
udf-key | \
stk-hdr-key"

#define CTC_CLI_ACL_FLEX_KEY_DESC   \
"Mac key", \
"Ipv4 key", \
"Mpls key", \
"Ipv6 key", \
"Hash mac key", \
"Hash ipv4 key", \
"Hash l2 l3 key", \
"Hash mpls key", \
"Hash ipv6 key", \
"Hash nsh key", \
"Pbr ipv4 key", \
"Pbr ipv6 key", \
"Ipv4 ext key", \
"Mac ipv4 key", \
"Mac ipv4 ext key", \
"Ipv6 ext key", \
"Mac ipv6 key", \
"Cid key", \
"Interface key", \
"Fwd key", \
"Fwd ext key", \
"Copp key", \
"Copp ext key", \
"Udf key", \
"Stk hdr key"


CTC_CLI(ctc_cli_usw_acl_show_entry_info,
        ctc_cli_usw_acl_show_entry_info_cmd,
        "show acl entry-info "\
    "(all (divide-by-group|) | entry ENTRY_ID |group GROUP_ID |priority PRIORITY |lookup-level VALUE |)" \
    "(type (mac|ipv4|ipv6|cid|intf|fwd|udf)|)"\
    "(grep {"CTC_CLI_ACL_KEY_FIELD_TYPE_GREP_STR"} |)(detail (ext-info|)|)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Entry info",
        "All entries",
        "All entrise divide by group",
        "By entry",
        CTC_CLI_ACL_ENTRY_ID_VALUE,
        "By group",
        CTC_CLI_ACL_B_GROUP_ID_VALUE,
        "By group priority",
        CTC_CLI_ACL_GROUP_PRIO_VALUE,
        "By lookup level",
        "Lookup level",
        "By type",
        "ACL Mac-entry",
        "ACL Ipv4-entry",
        "ACL Ipv6-entry",
        "ACL Cid-entry",
        "ACL Intf-entry",
        "ACL Fwd-entry",
        "ACL UDF-entry",
        "Grep",
        CTC_CLI_ACL_KEY_FIELD_TYPE_GREP_DESC,
        "Detail",
        "Extern infomation"
        )
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint8 type = 0;
    uint8 detail = 0;
    uint8 grep_cnt = 0;
    uint8 grep_i = 0;
    uint8 is_add = 1;
    uint8 show_inner = 0;
    uint8* p_null = NULL;
     /*uint8 scl_id = 0;*/
    uint32 param = 0;
    ctc_acl_key_type_t key_type = CTC_ACL_KEY_NUM;
    ctc_field_key_t grep_key[CTC_CLI_ACL_KEY_FIELED_GREP_NUM];
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
     /*ctc_port_bitmap_t pbmp = {0};*/
    uint32 data64[2]={0};
    uint32 mask64[2]={0};
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data, sudf_data;
    ctc_acl_udf_t udf_data_mask, sudf_data_mask;
     /*CTC_CLI_ACL_COMMON_VAR;*/
    mac_addr_t  mac_da_addr = {0};
    mac_addr_t  mac_da_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    mac_addr_t  mac_sa_addr = {0};
    mac_addr_t  mac_sa_addr_mask = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    ipv6_addr_t ipv6_da_addr = {0};
    ipv6_addr_t ipv6_da_addr_mask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
    ipv6_addr_t ipv6_sa_addr = {0};
    ipv6_addr_t ipv6_sa_addr_mask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};


    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0xFF, sizeof(ctc_field_port_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0xFF, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(udf_data));
    sal_memset(&udf_data_mask, 0xFF, sizeof(udf_data_mask));
    sal_memset(&sudf_data, 0, sizeof(udf_data));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(sudf_data_mask));
    sal_memset(data64, 0, sizeof(data64));
    sal_memset(mask64, 0xFF, sizeof(mask64));

    sal_memset(grep_key, 0, sizeof(grep_key));
    for (grep_i = 0; grep_i < CTC_CLI_ACL_KEY_FIELED_GREP_NUM; grep_i++)
    {
        grep_key[grep_i].mask = 0xFFFFFFFF;
    }

    index = CTC_CLI_GET_ARGC_INDEX("all");
    if (INDEX_VALID(index))
    {
        type = 0;

        index = CTC_CLI_GET_ARGC_INDEX("divide-by-group");
        if (INDEX_VALID(index))
        { /*0 = by priority. 1 = by group*/
            param = 1;
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("entry");
    if (INDEX_VALID(index))
    {
        type = 1;
        CTC_CLI_GET_UINT32("entry id", param, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("group");
    if (INDEX_VALID(index))
    {
        type = 2;
        CTC_CLI_GET_UINT32("group id", param, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("priority");
    if (INDEX_VALID(index))
    {
        type = 3;
        CTC_CLI_GET_UINT32("priority", param, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("lookup-level");
    if (INDEX_VALID(index))
    {
        type = 4;
        CTC_CLI_GET_UINT32("lookup-level", param, argv[index + 1]);
    }



    index = CTC_CLI_GET_ARGC_INDEX("type");
    if (INDEX_VALID(index))
    {
        if CLI_CLI_STR_EQUAL("mac", index + 1)
        {
            key_type = CTC_ACL_KEY_MAC;
        }
        else if CLI_CLI_STR_EQUAL("ipv4", index + 1)
        {
            key_type = CTC_ACL_KEY_IPV4;
        }
        else if CLI_CLI_STR_EQUAL("ipv6", index + 1)
        {
            key_type = CTC_ACL_KEY_IPV6;
        }
        else if CLI_CLI_STR_EQUAL("cid", index + 1)
        {
            key_type = CTC_ACL_KEY_CID;
        }
        else if CLI_CLI_STR_EQUAL("intf", index + 1)
        {
            key_type = CTC_ACL_KEY_INTERFACE;
        }
        else if CLI_CLI_STR_EQUAL("fwd", index + 1)
        {
            key_type = CTC_ACL_KEY_FWD;
        }
        else if CLI_CLI_STR_EQUAL("udf", index + 1)
        {
            key_type = CTC_ACL_KEY_UDF;
        }
    }
    else /*all type*/
    {
        key_type = CTC_ACL_KEY_NUM;
    }

    index = CTC_CLI_GET_ARGC_INDEX("detail");
    if (INDEX_VALID(index))
    {
        detail = 1;
        index = CTC_CLI_GET_ARGC_INDEX("ext-info");
        if (INDEX_VALID(index))
        {
            show_inner = 1;
        }
    }

/*
    index = CTC_CLI_GET_ARGC_INDEX("grep");
    if (0xFF != index)
    {
        uint8 start = index;
        CTC_CLI_ACL_KEY_FIELD_SET(grep_key[grep_cnt], CTC_CLI_ACL_KEY_ARG_CHECK(grep_cnt, CTC_CLI_ACL_KEY_FIELED_GREP_NUM), start);
    }
*/
    CTC_CLI_ACL_KEY_FIELD_GREP_SET(grep_key[grep_cnt],CTC_CLI_ACL_KEY_ARG_CHECK(grep_cnt,(CTC_CLI_ACL_KEY_FIELED_GREP_NUM - 1), p_null));

    ret = sys_usw_acl_show_entry(g_api_lchip, type, param, key_type, detail, grep_key, grep_cnt, show_inner);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

int32 sys_usw_acl_get_aset(uint8 lchip, uint8 type, uint32 parm, ctc_acl_aset_t* aset);

CTC_CLI(ctc_cli_usw_acl_show_aset_info,
        ctc_cli_usw_acl_show_aset_info_cmd,
        "show acl (entry-aset entry ENTRY_ID | group-aset group GROUP_ID)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Entry aset info",
        CTC_CLI_ACL_ENTRY_ID_STR,
        CTC_CLI_ACL_ENTRY_ID_VALUE,
        "Group aset info",
        "Group id",
        CTC_CLI_ACL_B_GROUP_ID_VALUE)
{
    int32 ret;
    ctc_acl_aset_t aset = {0};
    uint8 index = 0xFF;
    uint8 type = 0;
    uint32 param = 0;
    uint8 loop = 0;
    char* type_str[3] = {"igs-tcam", "egs-tcam", "igs-hash"};

    sal_memset(&aset, 0, sizeof(ctc_acl_aset_t));

    index = CTC_CLI_GET_ARGC_INDEX("entry-aset");
    if (INDEX_VALID(index))
    {
        type = 1;
        CTC_CLI_GET_UINT32("entry id", param, argv[index + 2]);
    }
    
    index = CTC_CLI_GET_ARGC_INDEX("group-aset");
    if (INDEX_VALID(index))
    {
        type = 2;
        CTC_CLI_GET_UINT32("group id", param, argv[index + 2]);
    }

    ret = sys_usw_acl_get_aset(g_api_lchip,type,param, &aset);

    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    else
    {
        index = 1;
        ctc_cli_out("ASET_ID:       %d, type:   %s. \n", aset.aset_id, type_str[aset.type%3]);
        ctc_cli_out("%-3s       %-26s\n", "ID", "FIELD");
        ctc_cli_out("------------------------------------\n");

        for(; loop < CTC_ACL_FIELD_ACTION_NUM ; loop++)
        {
            if(CTC_BMP_ISSET(aset.w, loop))
            {
                ctc_cli_out("%-3u       %-26s\n", index, action_field_str[loop]);
                index++;
            }
        }
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_aset_info1,
        ctc_cli_usw_acl_show_aset_info1_cmd,
        "show acl aset-idx ASET_ID (type TYPE |)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Aset id",
        "Aset id value",
        "Aset type",
        "0: igs-tcam, 1: egs-tcam, 2: igs-hash")
{
    int32 ret;
    ctc_acl_aset_t aset = {0};
    uint8 index = 0xFF;
    uint8 loop = 0;
    char* type_str[3] = {"igs-tcam", "egs-tcam", "igs-hash"};

    sal_memset(&aset, 0, sizeof(ctc_acl_aset_t));

    CTC_CLI_GET_UINT8("aset-idx", aset.aset_id, argv[0]);
    index = CTC_CLI_GET_ARGC_INDEX("type");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT16("value", aset.type, argv[index + 1]);
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_get_aset_fields(g_api_ldev, &aset);
    }
    else
    {
        ret = ctc_acl_get_aset_fields(&aset);
    }

    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    else
    {
        index = 1;
        ctc_cli_out("ASET_ID:       %d, type:   %s. \n", aset.aset_id, type_str[aset.type%3]);
        ctc_cli_out("%-3s       %-26s\n", "ID", "FIELD");
        ctc_cli_out("------------------------------------\n");

        for(; loop < CTC_ACL_FIELD_ACTION_NUM ; loop++)
        {
            if(CTC_BMP_ISSET(aset.w, loop))
            {
                ctc_cli_out("%-3u       %-26s\n", index, action_field_str[loop]);
                index++;
            }
        }
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_set_hash_mac_field_sel,
        ctc_cli_usw_acl_set_hash_mac_field_sel_cmd,
        "acl (set|unset) hash-key-type mac field-sel-id SEL_ID field-mode (" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "MAC Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8 scl_id = 0;
    uint8* p_null = NULL;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    ctc_field_key_t key_field;
    uint8  data8[16]={0};
    uint8  mask8[16]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_MAC;
    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);
   /*parser field*/
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);

    index = CTC_CLI_GET_ARGC_INDEX("set");
    key_field.data =  (index != 0xFF) ? 1 :0;   /*set/unset*/

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_set_hash_ipv4_field_sel,
        ctc_cli_usw_acl_set_hash_ipv4_field_sel_cmd,
        "acl (set|unset) hash-key-type ipv4 field-sel-id SEL_ID field-mode" \
        "(" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "IPV4 Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];
    ctc_field_key_t key_field;
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_IPV4;
    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);

    /*parser field*/
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);

    index = CTC_CLI_GET_ARGC_INDEX("set");
    key_field.data = (index != 0xFF) ? 1 :0;  /*set/unset*/
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_set_hash_ipv6_field_sel,
        ctc_cli_usw_acl_set_hash_ipv6_field_sel_cmd,
        "acl (set|unset) hash-key-type ipv6 field-sel-id SEL_ID field-mode" \
        "(" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "IPV6 Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{

    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_field_key_t key_field;
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
	uint8 udf_ad_id_index = 0xFF;
	uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_IPV6;

    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);

    /*parser field*/
    //index = CTC_CLI_GET_ARGC_INDEX("set");
    //is_add = (index != 0xFF)? 1: 0;
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);
    //if ((key_field.type != CTC_FIELD_KEY_IP_DA) && (key_field.type != CTC_FIELD_KEY_IP_SA))
    {
        index = CTC_CLI_GET_ARGC_INDEX("set");
        key_field.data =  (index != 0xFF) ? 1 :0;  /*set/unset*/
    }
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_set_hash_mpls_field_sel,
        ctc_cli_usw_acl_set_hash_mpls_field_sel_cmd,
        "acl (set|unset) hash-key-type mpls field-sel-id SEL_ID field-mode" \
        "(" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "MPLS Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    ctc_field_key_t key_field;
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_MPLS;
    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);

     /*parser field*/
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);
    index = CTC_CLI_GET_ARGC_INDEX("set");
    key_field.data =  (index != 0xFF) ? 1 :0;  /*set/unset*/

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_set_hash_l2_l3_field_sel,
        ctc_cli_usw_acl_set_hash_l2_l3_field_sel_cmd,
        "acl (set|unset) hash-key-type l2-l3 field-sel-id SEL_ID field-mode" \
        "(" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "L2_L3 Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_field_key_t key_field;
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_L2_L3;

    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);

     /*parser field*/
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);
    index = CTC_CLI_GET_ARGC_INDEX("set");
    key_field.data =  (index != 0xFF) ? 1 :0;  /*set/unset*/
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_set_hash_nsh_field_sel,
        ctc_cli_usw_acl_set_hash_nsh_field_sel_cmd,
        "acl (set|unset) hash-key-type nsh field-sel-id SEL_ID field-mode" \
        "(" CTC_CLI_ACL_KEY_FIELD_STR_0 "|"CTC_CLI_ACL_KEY_FIELD_STR_1 ")",
        CTC_CLI_ACL_STR,
        "Set",
        "Unset",
        "Hash Key type",
        "NSH Hash Key",
        CTC_CLI_FIELD_SEL_ID_DESC,
        CTC_CLI_FIELD_SEL_ID_VALUE,
        CTC_CLI_FIELD_SEL_ID_FILED_MODE_DESC,
        CTC_CLI_ACL_KEY_FIELD_DESC_0,
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 arg_cnt = 0;
    uint8 field_sel_id;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
     ctc_xdata_field_t xdata_field[35];
    ctc_field_key_t key_field;
    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_type = CTC_ACL_KEY_HASH_NSH;
    CTC_CLI_GET_UINT32("field-sel-id", field_sel_id, argv[1]);

    /*parser field*/
    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 0);

    index = CTC_CLI_GET_ARGC_INDEX("set");
    key_field.data = (index != 0xFF) ? 1 :0;  /*set/unset*/
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_field_to_hash_field_sel(g_api_ldev,key_type,field_sel_id ,&key_field);
    }
    else
    {
        ret = ctc_acl_set_field_to_hash_field_sel(key_type,field_sel_id,&key_field);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_add_key_field_0,
        ctc_cli_usw_acl_add_key_field_cmd_0,
        "acl (entry|presel-entry) ENTRY_ID (add|remove) key-field {"CTC_CLI_ACL_KEY_FIELD_STR_0 "}",
        CTC_CLI_ACL_STR,
        "Acl entry id",
        "Presel entry",
        "ENTRY_ID",
        "Add","Remove",
        "Key field",
        CTC_CLI_ACL_KEY_FIELD_DESC_0)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8 is_presel = 0;
    uint8 arg_cnt = 0;
    uint32 field_cnt = 0;
    uint32 entry_id = 0;
    uint32 scl_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    ctc_field_key_t key_field[CTC_CLI_ACL_KEY_FIELED_GREP_NUM];
    ctc_field_key_t* p_field = &key_field[0];
    uint8  data8[16]={0};
    uint8  mask8[16]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0xFF, sizeof(ctc_field_port_t));
    sal_memset(key_field, 0, CTC_CLI_ACL_KEY_FIELED_GREP_NUM * sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0xFF, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    CTC_CLI_GET_UINT32("entry-id", entry_id, argv[1]);


    index = CTC_CLI_GET_ARGC_INDEX("presel-entry");
    if (0xFF != index)
    {
        is_presel = 1;
    }

    for (index=0; index<CTC_CLI_ACL_KEY_FIELED_GREP_NUM; index+=1)
    {
        key_field[index].mask = 0xFFFFFFFF;
    }


    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        is_add = 1;
    }

    CTC_CLI_ACL_KEY_FIELD_SET(p_field,CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,CTC_CLI_ACL_KEY_FIELED_GREP_NUM, p_field), 0);
    field_cnt = arg_cnt;

    if(g_ctcs_api_en)
    {
        if(is_add)
        {
            if (is_presel)
            {
                ret = ctcs_acl_add_presel_fields(g_api_ldev, entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctcs_acl_add_key_field_list(g_api_ldev, entry_id, key_field, &field_cnt): ctcs_acl_add_key_field(g_api_ldev, entry_id, key_field);
            }
        }
        else
        {
            if (is_presel)
            {
                ret = ctcs_acl_remove_presel_fields(g_api_ldev, entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctcs_acl_remove_key_field_list(g_api_ldev, entry_id, key_field, &field_cnt): ctcs_acl_remove_key_field(g_api_ldev, entry_id, key_field);
            }
        }
    }
    else
    {
        if(is_add)
        {
            if (is_presel)
            {
                ret = ctc_acl_add_presel_fields(entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctc_acl_add_key_field_list(entry_id, key_field, &field_cnt): ctc_acl_add_key_field(entry_id, key_field);
            }
        }
        else
        {
            if (is_presel)
            {
                ret = ctc_acl_remove_presel_fields(entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctc_acl_remove_key_field_list(entry_id, key_field, &field_cnt): ctc_acl_remove_key_field(entry_id, key_field);
            }
        }
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        if ((1<arg_cnt) && !is_presel)
        {
            ctc_cli_out("%% %6s %u field successfully! \n", is_add? "add": "remove", field_cnt);
        }
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_add_key_field_1,
        ctc_cli_usw_acl_add_key_field_cmd_1,
        "acl (entry|presel-entry)  ENTRY_ID (add|remove) key-field {" CTC_CLI_ACL_KEY_FIELD_STR_1 "}",
        CTC_CLI_ACL_STR,
        "Acl entry id",
        "Presel entry",
        "ENTRY_ID",
        "Add","Remove",
        "Key field",
        CTC_CLI_ACL_KEY_FIELD_DESC_1)
{

    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 is_add = 0;
    uint8 is_presel = 0;
    uint8 arg_cnt = 0;
    uint8 scl_id = 0;
    uint32 field_cnt = 0;
    uint32 entry_id = 0;
    ctc_port_bitmap_t pbmp = {0};
    ctc_field_key_t key_field[CTC_CLI_ACL_KEY_FIELED_GREP_NUM];
    ctc_field_key_t* p_field = &key_field[0];
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    uint8  data8[16]={0};
    uint8  mask8[16]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
	uint8 udf_ad_id_index = 0xFF;
	uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;

    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0xFF, sizeof(ctc_field_port_t));
    sal_memset(key_field, 0, CTC_CLI_ACL_KEY_FIELED_GREP_NUM * sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0xFF, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&udf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&udf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(mask8, 0xFF, sizeof(mask8));
    sal_memset(&sudf_data, 0, sizeof(ctc_acl_udf_t));
    sal_memset(&sudf_data_mask, 0xFF, sizeof(ctc_acl_udf_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    for (index=0; index<CTC_CLI_ACL_KEY_FIELED_GREP_NUM; index+=1)
    {
        key_field[index].mask = 0xFFFFFFFF;
    }
    CTC_CLI_GET_UINT32("entry-id", entry_id, argv[1]);


    index = CTC_CLI_GET_ARGC_INDEX("presel-entry");
    if (0xFF != index)
    {
        is_presel = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        is_add = 1;
    }
    CTC_CLI_ACL_KEY_FIELD_SET(p_field,CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,CTC_CLI_ACL_KEY_FIELED_GREP_NUM, p_field), 0);
    field_cnt = arg_cnt;
    if(g_ctcs_api_en)
    {
        if(is_add)
        {
            if (is_presel == 1)
            {
                ret = ctcs_acl_add_presel_fields(g_api_ldev, entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctcs_acl_add_key_field_list(g_api_ldev, entry_id, key_field, &field_cnt): ctcs_acl_add_key_field(g_api_ldev, entry_id, key_field);
            }
        }
        else
        {
            if (is_presel == 1)
            {
                ret = ctcs_acl_remove_presel_fields(g_api_ldev, entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctcs_acl_remove_key_field_list(g_api_ldev, entry_id, key_field, &field_cnt): ctcs_acl_remove_key_field(g_api_ldev, entry_id, key_field);
            }
        }
    }
    else
    {
        if(is_add)
        {
            if (is_presel == 1)
            {
                ret = ctc_acl_add_presel_fields(entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctc_acl_add_key_field_list(entry_id, key_field, &field_cnt): ctc_acl_add_key_field(entry_id, key_field);
            }
        }
        else
        {
            if (is_presel == 1)
            {
                ret = ctc_acl_remove_presel_fields(entry_id, field_cnt, key_field);
            }
            else
            {
                ret = field_cnt>1? ctc_acl_remove_key_field_list(entry_id, key_field, &field_cnt): ctc_acl_remove_key_field(entry_id, key_field);
            }
        }
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        if (1<arg_cnt)
        {
            ctc_cli_out("%% %6s %u field successfully! \n", is_add? "add": "remove", field_cnt);
        }
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_add_action_field,
        ctc_cli_usw_acl_add_action_field_cmd,
        "acl entry ENTRY_ID add action-field {" CTC_CLI_ACL_ADD_FIELD_ACTION_STR "}",
        CTC_CLI_ACL_STR,
        "Acl entry id",
        "ENTRY_ID",
        "Add one action field to an entry",
        "Action field",
        CTC_CLI_ACL_ADD_FIELD_ACTION_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 arg_cnt = 0;
    uint8  loop = 0;
    uint32 field_cnt = 0;
    uint32 entry_id = 0;
    ctc_acl_field_action_t act_field[CTC_CLI_ACL_KEY_FIELED_GREP_NUM];
    ctc_acl_field_action_t* p_field = &act_field[0];
    ctc_acl_vlan_edit_t vlan_edit;
    ctc_acl_packet_strip_t packet_strip;
    ctc_acl_ipfix_t ipfix;
    ctc_acl_lb_hash_t lb_hash;
    ctc_acl_oam_t oam_t;
    ctc_acl_to_cpu_t cp_to_cpu;
    ctc_acl_table_map_t table_map;
    ctc_acl_inter_cn_t inter_cn;
    ctc_acl_log_t rand_log;
    ctc_acl_vxlan_rsv_edit_t vxlan_rsv_edit;
    ctc_acl_timestamp_t timestamp;
    ctc_acl_int_t acl_int;
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    sal_memset(&vxlan_rsv_edit, 0, sizeof(ctc_acl_vxlan_rsv_edit_t));
    sal_memset(&vlan_edit, 0, sizeof(ctc_acl_vlan_edit_t));
    sal_memset(act_field, 0, CTC_CLI_ACL_KEY_FIELED_GREP_NUM * sizeof(ctc_acl_field_action_t));
    sal_memset(&packet_strip, 0, sizeof(ctc_acl_packet_strip_t));
    sal_memset(&ipfix, 0, sizeof(ctc_acl_ipfix_t));
    sal_memset(&oam_t, 0, sizeof(ctc_acl_oam_t));
    sal_memset(&cp_to_cpu, 0, sizeof(ctc_acl_to_cpu_t));
    sal_memset(&lb_hash, 0, sizeof(lb_hash));
    sal_memset(&table_map, 0, sizeof(ctc_acl_table_map_t));
    sal_memset(&inter_cn, 0, sizeof(ctc_acl_inter_cn_t));
    sal_memset(&rand_log, 0, sizeof(ctc_acl_log_t));
    sal_memset(&timestamp, 0, sizeof(ctc_acl_timestamp_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    CTC_CLI_GET_UINT32("entry-id", entry_id, argv[0]);
    CTC_CLI_ACL_ADD_FIELD_ACTION_SET(p_field,CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,CTC_CLI_ACL_KEY_FIELED_GREP_NUM,p_field));

    field_cnt = arg_cnt;

    for (loop=0; loop<field_cnt; loop++)
    {
        if (act_field[loop].type == CTC_ACL_FIELD_ACTION_MICRO_FLOW_POLICER &&
            act_field[loop+1].type == CTC_ACL_FIELD_ACTION_MACRO_FLOW_POLICER)
        {
            act_field[loop].data1 = act_field[loop+1].data0;
            if (loop+2<field_cnt)
            {
                sal_memcpy(&act_field[loop+1], &act_field[loop+2], (field_cnt-loop-2) * sizeof(ctc_acl_field_action_t));
            }
            field_cnt--;
            arg_cnt--;
        }
    }

    if(g_ctcs_api_en)
    {
        ret = field_cnt>1? ctcs_acl_add_action_field_list(g_api_ldev, entry_id, act_field, &field_cnt): ctcs_acl_add_action_field(g_api_ldev, entry_id, act_field);
    }
    else
    {

        ret = field_cnt>1? ctc_acl_add_action_field_list(entry_id, act_field, &field_cnt): ctc_acl_add_action_field(entry_id, act_field);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        if (1<arg_cnt)
        {
            ctc_cli_out("%% add %u field successfully! \n", field_cnt);
        }
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_remove_action_field,
        ctc_cli_usw_acl_remove_action_field_cmd,
        "acl entry ENTRY_ID remove action-field {" CTC_CLI_ACL_REMOVE_FIELD_ACTION_STR "}",
        CTC_CLI_ACL_STR,
        "Acl entry id",
        "ENTRY_ID",
        "Remove one action field to an entry",
        "Action field",
        CTC_CLI_ACL_REMOVE_FIELD_ACTION_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 arg_cnt = 0;
    uint32 field_cnt = 0;
    uint32 entry_id = 0;
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_acl_field_action_t act_field[CTC_CLI_ACL_KEY_FIELED_GREP_NUM];
    ctc_acl_field_action_t* p_field = &act_field[0];

    sal_memset(act_field, 0, CTC_CLI_ACL_KEY_FIELED_GREP_NUM * sizeof(ctc_acl_field_action_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    CTC_CLI_GET_UINT32("entry-id", entry_id, argv[0]);
    CTC_CLI_ACL_REMOVE_FIELD_ACTION_SET(p_field,CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt, CTC_CLI_ACL_KEY_FIELED_GREP_NUM, p_field));
    field_cnt = arg_cnt;
    if(g_ctcs_api_en)
    {
        ret = field_cnt>1? ctcs_acl_remove_action_field_list(g_api_ldev, entry_id, act_field, &field_cnt): ctcs_acl_remove_action_field(g_api_ldev, entry_id, act_field);
    }
    else
    {
        ret = field_cnt>1? ctc_acl_remove_action_field_list(entry_id, act_field, &field_cnt): ctc_acl_remove_action_field(entry_id, act_field);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        if (1<arg_cnt)
        {
            ctc_cli_out("%% remove %u field successfully! \n", field_cnt);
        }
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_add_entry,
        ctc_cli_usw_acl_add_entry_cmd,
        "acl add group GROUP_ID (entry ENTRY_ID) (entry-priority PRIORITY|)  \
        (" CTC_CLI_ACL_ENTRY_TYPE_STR "|flex-entry KEY_TYPE) field-mode (aset {"CTC_CLI_ACL_ASET_STR" profile PROFILE |} | aset-id ID |) ("CTC_CLI_PP_BMP"|)",
        CTC_CLI_ACL_ADD_ENTRY_DESC,
        CTC_CLI_ACL_ENTRY_TYPE_DESC,
        "Add flex entry",
        "Key type value",
        "Use key and action field to add entry",
        "Set aset",
        CTC_CLI_ACL_ASET_STR_DESC,
        "Xdata profile",
        "Xdata profile id value",
        "Use aset id",
        "Aset id value",
        CTC_CLI_PP_BMP_STR,
        CTC_CLI_PP_BMP_VALUE)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint32 gid = 0;
    ctc_acl_entry_t acl_entry;
    ctc_acl_aset_t aset;
    uint8 index_aset = 0;

    sal_memset(&acl_entry, 0, sizeof(ctc_acl_entry_t));
    sal_memset(&aset, 0 ,sizeof(ctc_acl_aset_t));

    CTC_CLI_GET_UINT32("group id", gid, argv[0]);

    CTC_CLI_GET_PP_BMP(index, acl_entry.pp_bmp);

    index = CTC_CLI_GET_ARGC_INDEX("entry");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("entry id", acl_entry.entry_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("entry-priority");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("entry-priority", acl_entry.priority, argv[index + 1]);
        acl_entry.priority_valid = 1;
    }
    acl_entry.mode = 1;

    CTC_CLI_ACL_KEY_TYPE_SET;
    CTC_CLI_ACL_SET_ASET_BMP(acl_entry.aset, aset);
    index = CTC_CLI_GET_ARGC_INDEX("xdata");
    if (0xFF != index)
    {
        index = CTC_CLI_GET_ARGC_INDEX("profile");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("profile-id", aset.xdata_prof_id, argv[index + 1]);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("flex-entry");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("flex-entry", acl_entry.key_type, argv[index + 1]);
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_add_entry(g_api_ldev, gid, &acl_entry);
    }
    else
    {
        ret = ctc_acl_add_entry(gid, &acl_entry);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_add_hash_entry,
        ctc_cli_usw_acl_add_hash_entry_cmd,
        "acl add group GROUP_ID (entry ENTRY_ID) (entry-priority PRIORITY|)  \
        (" CTC_CLI_ACL_HASH_ENTRY_TYPE_STR "|flex-entry KEY_TYPE)  field-mode (field-sel-id SEL_ID) (aset {" CTC_CLI_ACL_ASET_STR " profile PROFILE |} | aset-id ID |) ("CTC_CLI_PP_BMP"|)",
        CTC_CLI_ACL_ADD_ENTRY_DESC,
        CTC_CLI_ACL_HASH_ENTRY_TYPE_DESC,
        "Add flex entry",
        "Key type value",
        "Use key and action field to add entry",
        "Hash key field select id ",
        "Field select ID",
        "Set aset",
        CTC_CLI_ACL_ASET_STR_DESC,
        "Xdata profile",
        "Xdata profile id value",
        "Use aset id", 
        "Aset id value",
        CTC_CLI_PP_BMP_STR,
        CTC_CLI_PP_BMP_VALUE)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint32 gid = 0;
    ctc_acl_entry_t acl_entry;
    ctc_acl_aset_t aset ;
    uint8 index_aset = 0;

    sal_memset(&acl_entry, 0, sizeof(ctc_acl_entry_t));
    sal_memset(&aset, 0 ,sizeof(ctc_acl_aset_t));

    CTC_CLI_ACL_SET_ASET_BMP(acl_entry.aset, aset);
    index = CTC_CLI_GET_ARGC_INDEX("xdata");
    if (0xFF != index)
    {
        index = CTC_CLI_GET_ARGC_INDEX("profile");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("profile-id", aset.xdata_prof_id, argv[index + 1]);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("entry");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("entry id", acl_entry.entry_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("entry-priority");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("entry-priority", acl_entry.priority, argv[index + 1]);
        acl_entry.priority_valid = 1;
    }

    acl_entry.mode = 1;

    index = CTC_CLI_GET_ARGC_INDEX("field-sel-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("field-sel-id", acl_entry.hash_field_sel_id, argv[index + 1]);
    }

    CTC_CLI_ACL_KEY_TYPE_SET;

    index = CTC_CLI_GET_ARGC_INDEX("flex-entry");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("flex-entry", acl_entry.key_type, argv[index + 1]);
    }

    CTC_CLI_GET_UINT32("group id", gid, argv[0]);

    CTC_CLI_GET_PP_BMP(index, acl_entry.pp_bmp);

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_add_entry(g_api_ldev, gid, &acl_entry);
    }
    else
    {
        ret = ctc_acl_add_entry(gid, &acl_entry);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_add_cid_pair,
        ctc_cli_usw_acl_add_cid_pair_cmd,
        "acl (add|remove) (hash-cid-pair|tcam-cid-pair) {src-cid SRC_CID | dst-cid DST_CID | } \
         (permit | deny| overwrite-acl PRIORITY class-id CLASS_ID lkup-type (l2 | l3 |l2-l3 | vlan | l3-ext | l2-l3-ext | \
        cid | interface | forward | forward-ext |udf) (use-mapped-vlan|use-logic-port|use-port-bitmap|use-metadata| ) |) ("CTC_CLI_PP_BMP"|)",
        CTC_CLI_ACL_STR,
        "Add", "Remove",
        "Hash CategoryId Pair", "Tcam CategoryId Pair",
        "Src CategoryId", "value",
        "Dst CategoryId", "value",
        "Permit", "Discard",
        "Overwrite", "Acl priority",
        "Class-id", "CLASS_ID",
        "Tcam lookup type",
        "L2 key", "L3 key", "L2 L3 key", "Vlan key", "L3 extend key",
        "L2 L3 extend key", "Cid key", "Interface key", "Forward key", "Forward extend Key", "Udf key",
        "Use mapped vlan","Use logic port","Use port bitmap","Use metadata",
        CTC_CLI_PP_BMP_STR,
        CTC_CLI_PP_BMP_VALUE)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint8 is_add = 0;
    ctc_acl_cid_pair_t cid_pair;

    sal_memset(&cid_pair, 0, sizeof(ctc_acl_cid_pair_t));

    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        is_add = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("tcam-cid-pair");
    if (0xFF != index)
    {
        cid_pair.flag |= CTC_ACL_CID_PAIR_FLAG_FLEX;
    }
    index = CTC_CLI_GET_ARGC_INDEX("src-cid");
    if (0xFF != index)
    {
        cid_pair.flag |= CTC_ACL_CID_PAIR_FLAG_SRC_CID;
        CTC_CLI_GET_UINT16("src cid", cid_pair.src_cid, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dst-cid");
    if (0xFF != index)
    {
        cid_pair.flag |= CTC_ACL_CID_PAIR_FLAG_DST_CID;
        CTC_CLI_GET_UINT16("dst cid", cid_pair.dst_cid, argv[index + 1]);
    }
    if(is_add)
    {
        index = CTC_CLI_GET_ARGC_INDEX("permit");
        if (0xFF != index)
        {
            cid_pair.action_mode = CTC_ACL_CID_PAIR_ACTION_PERMIT;
        }
        index = CTC_CLI_GET_ARGC_INDEX("deny");
        if (0xFF != index)
        {
            cid_pair.action_mode = CTC_ACL_CID_PAIR_ACTION_DISCARD;
        }
        index = CTC_CLI_GET_ARGC_INDEX("overwrite-acl");
        if (0xFF != index)
        {
            cid_pair.action_mode = CTC_ACL_CID_PAIR_ACTION_OVERWRITE_ACL;
            CTC_CLI_GET_UINT8("acl priority", cid_pair.acl_prop.acl_priority, argv[index + 1]);
            index = CTC_CLI_GET_ARGC_INDEX("lkup-type");
            if(0xFF != index)
            {
                if(CTC_CLI_STR_EQUAL_ENHANCE("l2",index + 1))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_L2;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("l3",index + 1))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_L3;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("l2-l3",index + 1))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_L2_L3;
                }
                else if(CLI_CLI_STR_EQUAL("vlan",index + 1))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_VLAN;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("l3-ext",index + 1))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_L3_EXT;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("l2-l3-ext",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_L2_L3_EXT;
                }
                else if(CLI_CLI_STR_EQUAL("cid",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_CID;
                }
                else if(CLI_CLI_STR_EQUAL("interface",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_INTERFACE;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("forward",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_FORWARD;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("forward-ext",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_FORWARD_EXT;
                }
                else if(CTC_CLI_STR_EQUAL_ENHANCE("udf",index + 1 ))
                {
                    cid_pair.acl_prop.tcam_lkup_type = CTC_ACL_TCAM_LKUP_TYPE_UDF;
                }
            }
            index = CTC_CLI_GET_ARGC_INDEX("class-id");
            if(0xFF != index)
            {
                CTC_CLI_GET_UINT16("class-id", cid_pair.acl_prop.class_id, argv[index + 1]);
            }
            index = CTC_CLI_GET_ARGC_INDEX("use-mapped-vlan");
            if(0xFF != index)
            {
                CTC_SET_FLAG(cid_pair.acl_prop.flag, CTC_ACL_PROP_FLAG_USE_MAPPED_VLAN);
            }
            index = CTC_CLI_GET_ARGC_INDEX("use-logic-port");
            if(0xFF != index)
            {
                CTC_SET_FLAG(cid_pair.acl_prop.flag, CTC_ACL_PROP_FLAG_USE_LOGIC_PORT);
            }
            index = CTC_CLI_GET_ARGC_INDEX("use-port-bitmap");
            if(0xFF != index)
            {
                CTC_SET_FLAG(cid_pair.acl_prop.flag, CTC_ACL_PROP_FLAG_USE_PORT_BITMAP);
            }
            index = CTC_CLI_GET_ARGC_INDEX("use-metadata");
            if(0xFF != index)
            {
                CTC_SET_FLAG(cid_pair.acl_prop.flag, CTC_ACL_PROP_FLAG_USE_METADATA);
            }
        }
    }

    CTC_CLI_GET_PP_BMP(index, cid_pair.pp_bmp);

    if(g_ctcs_api_en)
    {
        if(is_add)
        {
            ret = ctcs_acl_add_cid_pair(g_api_ldev, &cid_pair);
        }
        else
        {
            ret = ctcs_acl_remove_cid_pair(g_api_ldev, &cid_pair);
        }
    }
    else
    {
        if(is_add)
        {
            ret = ctc_acl_add_cid_pair(&cid_pair);
        }
        else
        {
            ret = ctc_acl_remove_cid_pair(&cid_pair);
        }
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_cid_pair,
        ctc_cli_usw_acl_show_cid_pair_cmd,
        "show acl cid-pair (hash|tcam|both)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "CategoryId Pair",
        "Hash cid pair",
        "Tcam cid pair",
        "Both hash and tcam")
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint8 type = 0;
    ctc_acl_cid_pair_t cid_pair;

    sal_memset(&cid_pair, 0, sizeof(ctc_acl_cid_pair_t));

    index = CTC_CLI_GET_ARGC_INDEX("hash");
    if (0xFF != index)
    {
        type = 0;
    }
    index = CTC_CLI_GET_ARGC_INDEX("tcam");
    if (0xFF != index)
    {
        type = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("both");
    if (0xFF != index)
    {
        type = 2;
    }

    ret = sys_usw_acl_show_cid_pair(g_api_lchip, type);

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_create_group_ext,
        ctc_cli_usw_acl_create_group_ext_cmd,
        "acl create group GROUP_ID {priority PRIORITY |key-size SIZE|} direction (ingress|egress) \
        (l3if-class CLASS_ID | hash )  (aset {" CTC_CLI_ACL_ASET_STR "| profile PROFILE| } | aset-id ID |)",
        CTC_CLI_ACL_STR,
        "Create ACL group",
        CTC_CLI_ACL_GROUP_ID_STR,
        CTC_CLI_ACL_S_GROUP_ID_VALUE,
        CTC_CLI_ACL_GROUP_PRIO_STR,
        CTC_CLI_ACL_GROUP_PRIO_VALUE,
        "Key size",
        "Key size value",
        "Direction",
        "Ingress",
        "Egress",
        "L3if class acl",
        "L3if class id",
        "Hash type",
        "Set aset",
        CTC_CLI_ACL_ASET_STR_DESC,
        "Xdata profile",
        "Xdata profile id value",
        "Aset-id",
        "Aset-id value")
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint32 group_id = 0;
    ctc_acl_group_info_t ginfo;
    ctc_acl_aset_t aset ;
    uint8 index_aset = 0;

    sal_memset(&ginfo, 0, sizeof(ctc_acl_group_info_t));
    sal_memset(&aset, 0 ,sizeof(ctc_acl_aset_t));

    CTC_CLI_ACL_SET_ASET_BMP(ginfo.aset, aset);
    index = CTC_CLI_GET_ARGC_INDEX("xdata");
    if (0xFF != index)
    {
        index = CTC_CLI_GET_ARGC_INDEX("profile");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("profile-id", aset.xdata_prof_id, argv[index + 1]);
        }
    }

    CTC_CLI_GET_UINT32("group id", group_id, argv[0]);

    index = CTC_CLI_GET_ARGC_INDEX("priority");
    if (INDEX_VALID(index) && index < index_aset)
    {
        CTC_CLI_GET_UINT8("group prioirty", ginfo.priority, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("key-size");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("key size", ginfo.key_size, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (INDEX_VALID(index))
    {
        ginfo.dir = CTC_INGRESS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (INDEX_VALID(index))
    {
        ginfo.dir = CTC_EGRESS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("both");
    if (INDEX_VALID(index))
    {
        ginfo.dir = CTC_BOTH_DIRECTION;
    }

    index = CTC_CLI_GET_ARGC_INDEX("l3if-class");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT16("l3if class id", ginfo.un.l3if_class_id, argv[index + 1]);
        ginfo.type  = CTC_ACL_GROUP_TYPE_L3IF_CLASS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("hash");
    if (INDEX_VALID(index))
    {
        ginfo.type  = CTC_ACL_GROUP_TYPE_HASH;
    }


    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_create_group(g_api_ldev, group_id, &ginfo);
    }
    else
    {
        ret = ctc_acl_create_group(group_id, &ginfo);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_show_block_status,
        ctc_cli_usw_acl_show_block_status_cmd,
        "show acl (block-id BLOCK_ID) (direction (ingress|egress)|) status {detail|virtual|}",
        "Show",
        CTC_CLI_ACL_STR,
        "Block id",
        "BLOCK ID",
        "Direction",
        "Ingress",
        "Egress",
        "Status",
        "Detail",
        "Virtual block"
        )
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 dir = CTC_INGRESS;
    uint8 block_id = 0;
    uint8 detail = 0;
    uint8 is_virtual = 0;

    index = CTC_CLI_GET_ARGC_INDEX("block-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("block-id", block_id, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (0xFF != index)
    {
        dir = CTC_EGRESS;
    }


    index = CTC_CLI_GET_ARGC_INDEX("detail");
    if (0xFF != index)
    {
        detail = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("virtual");
    if (0xFF != index)
    {
        is_virtual = 1;
    }

    ret = sys_usw_acl_show_tcam_alloc_status(g_api_lchip, dir, block_id, detail, is_virtual);

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;

}

CTC_CLI(ctc_cli_usw_acl_set_cid_prio,
        ctc_cli_usw_acl_set_cid_prio_cmd,
        "acl set (src-cid-prio pkt-cid VALUE0 i2e-cid VALUE1 global-cid VALUE2 static-cid VALUE3 dynamic-cid VALUE4  \
        if-cid VALUE5 default-cid VALUE6 | dst-cid-prio dynamic-cid VALUE0 dsflow-cid VALUE1 static-cid VALUE2       \
        default-cid VALUE3)",
        CTC_CLI_ACL_STR,
        "Set",
        "Src cid priority", "Cid from packet", "<0-7>", "Cid from header", "<0-7>", "Global cid", "<0-7>",
        "Static-cid from DsUserId, DsScl, DsFlow", "<0-7>", "Dynamic-cid from DsMacSa, DsIpSa", "<0-7>",
        "If-cid from port, vlan, if, tunnel", "<0-7>", "Default cid", "<0-7>",
        "Dest cid priority", "Dynamic-cid from DsMacDa, DsIpDa", "<0-3>", "Cid from DsFlow", "<0-3>",
        "Static-cid from DsUserId, DsScl", "<0-3>", "Default cid", "<0-3>"
        )
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 array[7] = {0};
    uint8 is_src = 0;

    index = CTC_CLI_GET_ARGC_INDEX("src-cid-prio");
    if (0xFF != index)
    {
        is_src = 1;
        CTC_CLI_GET_UINT8("pkt-cid",     array[0], argv[index + 2]);
        CTC_CLI_GET_UINT8("i2e-cid",     array[1], argv[index + 4]);
        CTC_CLI_GET_UINT8("global-cid",  array[2], argv[index + 6]);
        CTC_CLI_GET_UINT8("static-cid",  array[3], argv[index + 8]);
        CTC_CLI_GET_UINT8("dynamic-cid", array[4], argv[index + 10]);
        CTC_CLI_GET_UINT8("if-cid",      array[5], argv[index + 12]);
        CTC_CLI_GET_UINT8("default-cid", array[6], argv[index + 14]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("dst-cid-prio");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("static-cid",  array[0], argv[index + 2]);
        CTC_CLI_GET_UINT8("dsflow-cid",  array[1], argv[index + 4]);
        CTC_CLI_GET_UINT8("static-cid",  array[2], argv[index + 6]);
        CTC_CLI_GET_UINT8("default-cid", array[3], argv[index + 8]);
    }

    ret = sys_usw_acl_set_cid_priority(g_api_lchip, is_src, array);

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;

}
CTC_CLI(ctc_cli_usw_acl_add_udf_entry,
        ctc_cli_usw_acl_add_udf_entry_cmd,
        "acl add udf-entry UDF-ID priority PRIORITY (udf-ad-id UDF_AD_ID |)(offset-type TYPE | \
        {offset0-type  TYPE| offset1-type  TYPE| offset2-type  TYPE |offset3-type  TYPE \
        |offset4-type  TYPE| offset5-type  TYPE| offset6-type  TYPE |offset7-type  TYPE }) \
        {offset0  OFFSET |offset1  OFFSET |offset2  OFFSET |offset3  OFFSET \
        |offset4  OFFSET |offset5  OFFSET |offset6  OFFSET |offset7  OFFSET }\
        {udf-mask MASK |tcp-op |skip-vlan |granularity VALUE |sudf-en | ipfix-en |} \
        (scl-key {offset8-type TYPE| offset9-type TYPE| offset10-type TYPE| offset11-type TYPE \
        |offset12-type TYPE| offset13-type TYPE| offset14-type TYPE| offset15-type TYPE |} \
        {offset8 OFFSET| offset9 OFFSET| offset10 OFFSET| offset11 OFFSET \
        |offset12 OFFSET| offset13 OFFSET| offset14 OFFSET| offset15 OFFSET |} {udf-mask MASK |} |) (acl-xdata|) {"CTC_CLI_PP_BMP"|}",
        CTC_CLI_ACL_STR,
        "Add",
        "UDF Entry",
        "UDF ID",
        "Priority",
        "Priority ID",
        "UDF AD ID",
        "UDF AD ID",
        "Start offset-type",
        "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset0-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset1-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset2-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset3-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset4-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset5-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset6-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset7-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Offset0", "Offset Value",
        "Offset1", "Offset Value",
        "Offset2", "Offset Value",
        "Offset3", "Offset Value",
        "Offset4", "Offset Value",
        "Offset5", "Offset Value",
        "Offset6", "Offset Value",
        "Offset7", "Offset Value",
        "UDF Mask", "UDF Mask Value",
        "Tcp Options",
        "Skip Vlan",
        "Granularity", "Granularity Value",
        "Enable sudf",   
        "If set, indicate ipfix enable match UDF",
        "SCL Key udf",
        "Start offset8-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset9-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset10-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset11-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset12-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset13-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset14-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Start offset15-type",  "TYPE, refer to ctc_acl_udf_offset_type_t",
        "Offset8", "Offset Value",
        "Offset9", "Offset Value",
        "Offset10", "Offset Value",
        "Offset11", "Offset Value",
        "Offset12", "Offset Value",
        "Offset13", "Offset Value",
        "Offset14", "Offset Value",
        "Offset15", "Offset Value",
        "UDF Mask", "UDF Mask Value",
        "Acl xdata",
        CTC_CLI_PP_BMP_DESC)
{
    int32 ret = CLI_SUCCESS;

    uint8 index = 0, pre_udf_index = 0;
    uint8 loop = 0, sub_idx = 0;
    ctc_acl_classify_udf_t udf_entry, udf_entry_next;
    char* offset_type_array_str[] = {
            "offset0-type",  "offset1-type",  "offset2-type",  "offset3-type",
            "offset4-type",  "offset5-type",  "offset6-type",  "offset7-type",
            "offset8-type",  "offset9-type",  "offset10-type", "offset11-type",
            "offset12-type", "offset13-type", "offset14-type", "offset15-type"
        };
    char* offset_array_str[] = {
            "offset0",  "offset1",  "offset2",  "offset3",
            "offset4",  "offset5",  "offset6",  "offset7",
            "offset8",  "offset9",  "offset10", "offset11",
            "offset12", "offset13", "offset14", "offset15"
        };
    sal_memset(&udf_entry,0,sizeof(ctc_acl_classify_udf_t));
    sal_memset(&udf_entry_next,0,sizeof(ctc_acl_classify_udf_t));

    CTC_CLI_GET_UINT32("udf-id", udf_entry.udf_id, argv[0]);
    CTC_CLI_GET_UINT16("priority", udf_entry.priority, argv[1]);

    index = CTC_CLI_GET_ARGC_INDEX("offset-type");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("offset-type", udf_entry.offset_type, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("udf-ad-id");
    if (0xFF != index)
    {
        udf_entry.shared_udf = 1;
        CTC_CLI_GET_UINT16("udf-ad-id", udf_entry.udf_ad_id, argv[index + 1]);
    }
    udf_entry.offset_num = 0;
    for (loop=0; loop<CTC_ACL_UDF_FIELD_NUM; loop++)
    {
        index = CTC_CLI_GET_ARGC_INDEX(offset_type_array_str[loop]);
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8(offset_type_array_str[loop], udf_entry.offset_type_array[loop], argv[index + 1]);
        }
        index = CTC_CLI_GET_ARGC_INDEX(offset_array_str[loop]);
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8(offset_array_str[loop], udf_entry.offset[loop], argv[index + 1]);
            udf_entry.offset_num++;
        }
    }

    pre_udf_index = CTC_CLI_GET_ARGC_INDEX("scl-key");
    if (0xFF != pre_udf_index)
    {
        udf_entry.scl_key = &udf_entry_next;
        udf_entry_next.offset_num = 0;
        for (loop=0; 0xFF != pre_udf_index && loop<8; loop++)
        {
            index = CTC_CLI_GET_ARGC_INDEX(offset_type_array_str[loop+8]);
            if (0xFF != index)
            {
                CTC_CLI_GET_UINT8(offset_type_array_str[loop+8], udf_entry_next.offset_type_array[loop], argv[index + 1]);
            }
            index = CTC_CLI_GET_ARGC_INDEX(offset_array_str[loop+8]);
            if (0xFF != index)
            {
                CTC_CLI_GET_UINT8(offset_array_str[loop+8], udf_entry_next.offset[loop], argv[index + 1]);
                udf_entry_next.offset_num++;
            }
        }
        index = CTC_CLI_GET_RANGE_INDEX("udf-mask", 0, pre_udf_index);
        if (0xFF != index)
        {
            for (sub_idx = 0; sub_idx < CTC_ACL_UDF_BYTE_NUM; sub_idx++)
            {
                sal_sscanf(argv[index+1] + 2*sub_idx, "%2hhx", &udf_entry.mask[sub_idx]);
            }
        }
        index = CTC_CLI_GET_SPECIFIC_INDEX("udf-mask", pre_udf_index);
        if (0xFF != index)
        {
            for (sub_idx = 0; sub_idx < 16; sub_idx++)
            {
                sal_sscanf(argv[pre_udf_index+index+1] + 2*sub_idx, "%2hhx", &udf_entry_next.mask[sub_idx]);
            }
        }
    }
    else
    {
        index = CTC_CLI_GET_ARGC_INDEX("udf-mask");
        if (0xFF != index)
        {
            for (sub_idx = 0; sub_idx < CTC_ACL_UDF_BYTE_NUM; sub_idx++)
            {
                sal_sscanf(argv[index+1] + 2*sub_idx, "%2hhx", &udf_entry.mask[sub_idx]);
            }
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("tcp-op");
    if (0xFF != index)
    {
       udf_entry.tcp_option_en = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("skip-vlan");
    if (0xFF != index)
    {
       udf_entry.skip_vlan= 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("granularity");
    if (0xFF != index)
    {
       CTC_CLI_GET_UINT8("granularity", udf_entry.granularity, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("sudf-en");
    if (0xFF != index)
    {
       udf_entry.sudf_en = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("ipfix-en");
    if (0xFF != index)
    {
        udf_entry.ipfix_en = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("acl-xdata");
    if (0xFF != index)
    {
        udf_entry.flag |= CTC_ACL_CLASSIFY_UDF_ACL_XDATA;
    }
    CTC_CLI_GET_PP_BMP(index, udf_entry.pp_bmp);

     if(g_ctcs_api_en)
    {
        ret = ctcs_acl_add_udf_entry(g_api_ldev, &udf_entry);
    }
    else
    {
        ret = ctc_acl_add_udf_entry(&udf_entry);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    ctc_cli_out("%-13s : %u\n", "inner assign udf_ad_id is", udf_entry.udf_ad_id);
    return ret;
}


CTC_CLI(ctc_cli_usw_acl_remove_udf_entry,
        ctc_cli_usw_acl_remove_udf_entry_cmd,
        "acl remove udf-entry UDF-ID",
        CTC_CLI_ACL_STR,
        "Remove",
        "UDF Entry",
        "UDF ID")
{
    int32 ret = CLI_SUCCESS;

    ctc_acl_classify_udf_t udf_entry;
    sal_memset(&udf_entry, 0, sizeof(udf_entry));

    CTC_CLI_GET_UINT32("udf-id", udf_entry.udf_id, argv[0]);

     if(g_ctcs_api_en)
    {
        ret = ctcs_acl_remove_udf_entry(g_api_ldev, &udf_entry);
    }
    else
    {
        ret = ctc_acl_remove_udf_entry(&udf_entry);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

#define CTC_CLI_ACL_UDF_KEY_FIELD_STR "\
  l2-type (VALUE (MASK|)|)\
| l3-type (VALUE (MASK|)|) \
| l3-ext-type (VALUE (MASK|)|) \
| l4-type (VALUE (MASK|)|) \
| l4-user-type (VALUE (MASK|)|) \
| field-port (port-class (CLASS_ID MASK |) | vlan-class (CLASS_ID MASK |) | l3if-class  (CLASS_ID MASK |) | pbr-class (CLASS_ID MASK |) | logic-port (LOGICAL_PORT MASK|) | gport (GPORT MASK|) | port-bitmap (LCHIP PORT_BITMAP_3 PORT_BITMAP_2 PORT_BITMAP_1 PORT_BITMAP_0|)) \
| ether-type (VALUE (MASK|)|) \
| vlan-num (VALUE (MASK|)|) \
| ip-protocol (VALUE (MASK|)|) \
| ip-frag (VALUE (MASK|)|) \
| ip-options (VALUE (MASK|)|) \
| l4-dst-port (VALUE (MASK|)|) \
| l4-src-port (VALUE (MASK|)|) \
| tcp-op (VALUE (MASK|)|) \
| gre-flags (VALUE (MASK|)|) \
| gre-protocol (VALUE (MASK|)|) \
| label-num (VALUE (MASK|)|) \
| ip-over-mpls (VALUE (MASK|)|) \
| ipv6-over-mpls (VALUE (MASK|)|) \
| cw-exist (VALUE (MASK|)|) \
| ether-type-ext (VALUE (MASK|)|) \
| xdata array-field FIELD \
| udf-entry-valid (VALUE (MASK|)|) \
"

#define CTC_CLI_ACL_UDF_KEY_FIELD_DESC \
"Layer 2 type (ctc_parser_l2_type_t) ", "value", "mask",\
"Layer 3 type (ctc_parser_l3_type_t) ", "value", "mask", \
"Layer 3 ext type (ctc_parser_l3_ext_type_t) ", "value", "mask", \
"Layer 4 type (ctc_parser_l4_type_t) ", "value", "mask",\
"Layer 4 user-type (ctc_parser_l4_usertype_t) ", "value", "mask",\
"Port-type","Port class id", "value","mask","Vlan class id","value", "mask","L3if class id","value", "mask","Pbr class id","value", "mask","Logic port","value", "mask","Global port","value", "mask",\
CTC_CLI_ACL_PORT_BITMAP,CTC_CLI_LCHIP_ID_VALUE,"Port bitmap_3 <port96~port127>","Port bitmap_2 <port64~port95>","Port bitmap_1 <port32~port63>","Port bitmap_0 <port0~port31>",\
"Ether type ", "value", "mask",\
"Vlan tag number", "value", "mask",\
"Ip protocol ", "value", "mask",\
"Ip fragment information ", "value", "mask",\
"Ip options ", "value", "mask",\
"Layer 4 dest port ", "value", "mask",\
"Layer 4 src port ", "value", "mask",\
"Tcp options ", "value", "mask",\
"Gre flags ", "value", "mask",\
"Gre protocol ", "value", "mask",\
"Mpls label number ", "value", "mask",\
"Ip over mpls ", "value", "mask",\
"Ipv6 over mpls ", "value", "mask",\
"Mpls Cw exist ", "value", "mask",\
"Ether type ext", "value", "mask",\
"XDATA","Field array of xdata key value","Two-dimensional Array,array number is ctc_xdata_field_t,format is [[WIDTH ,OFFSET ,DATA ,MASK ,FLAG],[...]].For example,[[4,0,0xf,0xf]],FLAG is invalid.",\
"UDF Entry valid ", "value", "mask"

CTC_CLI(ctc_cli_usw_acl_add_remove_udf_entry_key_field,
        ctc_cli_usw_acl_add_remove_udf_entry_key_field_cmd,
        "acl udf-entry UDF_ID (add|remove) key-field(" CTC_CLI_ACL_UDF_KEY_FIELD_STR")",
        CTC_CLI_ACL_STR,
        "UDF Entry",
        "UDF entry id",
        "Add",
        "Remove",
        "Key field",
        CTC_CLI_ACL_UDF_KEY_FIELD_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 arg_cnt = 0;
    uint8 is_add = 0;
    uint8* p_null = NULL;
    uint8 scl_id = 0;
    uint32 entry_id = 0;
    ctc_field_port_t port_info;
    ctc_field_port_t port_info_mask;
    ctc_port_bitmap_t pbmp = {0};
    ctc_field_key_t key_field;
    uint8  data8[8]={0};
    uint8  mask8[8]={0};
    ctc_xdata_t xdata;
    ctc_xdata_field_t xdata_field[35];

    ctc_acl_tunnel_data_t tunnel_data;
    ctc_acl_tunnel_data_t tunnel_data_mask;
    ctc_acl_udf_t udf_data;
    ctc_acl_udf_t udf_data_mask;
    ctc_acl_udf_t sudf_data;
    ctc_acl_udf_t sudf_data_mask;
    uint32 stk_hdr_type_data = 0;
    uint32 stk_hdr_type_mask = 0;
    uint8 udf_ad_id_index = 0xFF;
    uint8 sudf_ad_id_index = 0xFF;
    uint32 udf_ext_data = 0;
    uint32 udf_ext_mask = 0;
    uint32 dsnh_offset = 0;
    uint32 dsnh_offset_mask = 0;
    CTC_CLI_ACL_COMMON_VAR;

    sal_memset(&port_info, 0, sizeof(ctc_field_port_t));
    sal_memset(&port_info_mask, 0, sizeof(ctc_field_port_t));
    sal_memset(&key_field, 0, sizeof(ctc_field_key_t));
    sal_memset(&tunnel_data, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&tunnel_data_mask, 0, sizeof(ctc_acl_tunnel_data_t));
    sal_memset(&xdata, 0, sizeof(ctc_xdata_t));
    sal_memset(xdata_field, 0, sizeof(ctc_xdata_field_t)*35);

    key_field.mask = 0xFFFFFFFF;

    CTC_CLI_GET_UINT32("entry-id", entry_id, argv[0]);

    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        is_add = 1;
    }

    CTC_CLI_ACL_KEY_FIELD_SET((&key_field),CTC_CLI_ACL_KEY_ARG_CHECK(arg_cnt,1, p_null), 3);

    if(g_ctcs_api_en)
    {
        if(is_add)
        {
            ret = ctcs_acl_add_udf_entry_key_field(g_api_ldev, entry_id, &key_field);
        }
        else
        {
            ret = ctcs_acl_remove_udf_entry_key_field(g_api_ldev, entry_id, &key_field);
        }
    }
    else
    {
        if(is_add)
        {
            ret = ctc_acl_add_udf_entry_key_field(entry_id, &key_field);
        }
        else
        {
            ret = ctc_acl_remove_udf_entry_key_field(entry_id, &key_field);
        }
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_udf_entry,
        ctc_cli_usw_acl_show_udf_entry_cmd,
        "show acl udf-entry (udf-id UDF-ID | priority PRIORITY) ("CTC_CLI_PP_BMP"|)",
        "Show",
        CTC_CLI_ACL_STR,
        "UDF-Entry",
        "UDF entry id",
        "UDF entry id",
        "UDF entry Priority",
        "UDF entry Priority",
        CTC_CLI_PP_BMP_DESC)
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0;
    uint8 loop = 0;

    ctc_acl_classify_udf_t udf_entry, udf_entry_next;
    sal_memset(&udf_entry, 0, sizeof(ctc_acl_classify_udf_t));
    sal_memset(&udf_entry_next, 0, sizeof(ctc_acl_classify_udf_t));
    udf_entry.scl_key = &udf_entry_next;

    CTC_CLI_GET_PP_BMP(index, udf_entry.pp_bmp);

    index = CTC_CLI_GET_ARGC_INDEX("udf-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("udf-id", udf_entry.udf_id, argv[index + 1]);
        udf_entry.query_type = 0;
    }
    index = CTC_CLI_GET_ARGC_INDEX("priority");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT16("priority", udf_entry.priority, argv[index + 1]);
        udf_entry.query_type = 1;
    }
    if (g_ctcs_api_en)
    {
        ret = ctcs_acl_get_udf_entry(g_api_ldev, &udf_entry);
    }
    else
    {
        ret = ctc_acl_get_udf_entry(&udf_entry);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    if (CTC_FLAG_ISSET(udf_entry.flag, CTC_ACL_CLASSIFY_UDF_ACL_XDATA))
    {
        ctc_cli_out("%-13s : %s\n", "flag", "udf acl xdata");
    }
    ctc_cli_out("%-13s : %s\n", "ad table name", udf_entry.sudf_en ? "ParserUdfCamResult0":"ParserUdfCamResult1");
    ctc_cli_out("%-13s : %u\n", "sudf_en", udf_entry.sudf_en);
    ctc_cli_out("%-13s : %u\n", "udf-id", udf_entry.udf_id);
    ctc_cli_out("%-13s : %u\n", "udf-ad-id", udf_entry.udf_ad_id);
    if(0 == udf_entry.sudf_en)
    {
        ctc_cli_out("%-13s : %u\n", "priority", udf_entry.priority);
    }
    else
    {
        ctc_cli_out("%-13s : -\n", "priority");
    }
    ctc_cli_out("%-13s : %d\n", "valid", udf_entry.valid);
    ctc_cli_out("%-13s : %d\n", "granularity", udf_entry.granularity);
    ctc_cli_out("%-13s : %d\n", "tcp_option_en", udf_entry.tcp_option_en);
    ctc_cli_out("%-13s : %d\n", "skip_vlan", udf_entry.skip_vlan);
    ctc_cli_out("%-13s : %d\n", "ipfix_en", udf_entry.ipfix_en);
    ctc_cli_out("%-13s : %d\n", "offset_type", udf_entry.offset_type);
    ctc_cli_out("%-13s : %d\n", "offset_num", udf_entry.offset_num);
    for (loop = 0; loop < udf_entry.offset_num; loop++)
    {
        ctc_cli_out("offset%02u_type : %u\n", loop, udf_entry.offset_type_array[loop]);
        ctc_cli_out("offset%02u : %u\n", loop, udf_entry.offset[loop]);
    }
    ctc_cli_out("%-13s : ", "udf_mask");
    for (loop = 0; loop < CTC_ACL_UDF_BYTE_NUM; loop++)
    {
        ctc_cli_out("%02hhX", udf_entry.mask[loop]);
    }
    ctc_cli_out("\n");
    if (udf_entry.scl_key)
    {
        ctc_cli_out("--------------------------------------------------\n");
        ctc_cli_out("SCL Key:\n");
        ctc_cli_out("%-13s : %s\n", "ad table name", "ParserUdfCamResult2");
        ctc_cli_out("%-13s : %d\n", "offset_num", udf_entry_next.offset_num);
        for (loop = 0; loop < udf_entry_next.offset_num; loop++)
        {
            ctc_cli_out("offset%02u_type : %u\n", loop+8, udf_entry_next.offset_type_array[loop]);
            ctc_cli_out("offset%02u : %u\n", loop+8, udf_entry_next.offset[loop]);
        }
        ctc_cli_out("%-13s : ", "udf_mask");
        for (loop = 0; loop < 16; loop++)
        {
            ctc_cli_out("%02hhX", udf_entry_next.mask[loop]);
        }
        ctc_cli_out("\n");
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_udf_entry_status,
        ctc_cli_usw_acl_show_udf_entry_status_cmd,
        "show acl udf-entry status",
        "Show",
        CTC_CLI_ACL_STR,
        "UDF-Entry",
        "UDF Overall status"
        )
{

    int32 ret = CLI_SUCCESS;

    ret = sys_usw_acl_dump_udf_entry_info(g_api_lchip);

    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_show_league_mode,
        ctc_cli_usw_acl_show_league_mode_cmd,
        "show acl league-mode (detail|)",
        "Show",
        CTC_CLI_ACL_STR,
        "League mode",
        "Detail info")
{
    int32 ret = 0;
    uint8 pp_id = 0;
    uint8 prio = 0;
    uint8 idx = 0xFF;
    uint8 igs_acl_block_num = 24;
    uint8 egs_acl_block_num = 12;
    uint8 league_list[CTC_MAX_ACL_LKUP_NUM] = {0};
    ctc_acl_league_t acl_league;
    uint8 detail = 0;
    uint32  lkup_pp_en_bitmap = 0;

    CTC_CLI_GET_PP_ID(pp_id);
    sal_memset(&acl_league, 0, sizeof(ctc_acl_league_t));
    acl_league.dir = CTC_INGRESS;
    idx = CTC_CLI_GET_ARGC_INDEX("detail");
    if (0xFF != idx)
    {
        acl_league.leagued_list = league_list;
        detail = 1;
    }
    ctc_cli_out("%-15s%-15s%-15s\n","Dir","Prio","League-Mode");
    if(detail)
    {
        ctc_cli_out("%-15s%-15s%-15s\n","League-size","League-order","*:Global-lookup");
    }
    ctc_cli_out("-------------------------------------------------------------\n");

    for (prio = 0; prio < igs_acl_block_num; prio++)
    {
        acl_league.acl_priority = prio;
        acl_league.list_cnt = CTC_MAX_ACL_LKUP_NUM;
        acl_league.pp_bmp = 1<<pp_id;
        if (g_ctcs_api_en)
        {
            ret = ctcs_acl_get_league_mode(g_api_ldev, &acl_league);
        }
        else
        {
            ret = ctc_acl_get_league_mode(&acl_league);
        }
        if (ret < 0)
        {
            continue;
        }

        ctc_cli_out("%-15s%-15u", "Ingress", prio);

        lkup_pp_en_bitmap = sys_usw_acl_get_lkup_pp_en_bmp(g_api_lchip, 0);

        for (idx = 0; idx < igs_acl_block_num; idx++)
        {
            ctc_cli_out("%u ", (CTC_IS_BIT_SET(acl_league.lkup_level_bitmap, idx) ? 1: 0));
        }

        ctc_cli_out("\n");
        if(detail && (acl_league.list_cnt > 1 || (1 == acl_league.list_cnt && CTC_IS_BIT_SET(lkup_pp_en_bitmap, acl_league.leagued_list[0]))))
        {
            ctc_cli_out("%-15u", acl_league.size ? acl_league.size : 1);
            for(idx=0; idx < acl_league.list_cnt; idx++)
            {
                if(CTC_IS_BIT_SET(lkup_pp_en_bitmap, acl_league.leagued_list[idx]))
                {
                    ctc_cli_out("*");
                }            
                ctc_cli_out("%-3u", acl_league.leagued_list[idx]);            
            }
            ctc_cli_out("\n");
        }
    }

    for (prio=0; prio<egs_acl_block_num; prio++)
    {
        acl_league.acl_priority = prio;
        acl_league.dir = CTC_EGRESS;
        acl_league.list_cnt = egs_acl_block_num;
        acl_league.pp_bmp = 1<<pp_id;

        if(g_ctcs_api_en)
        {
            ret = ctcs_acl_get_league_mode(g_api_ldev, &acl_league);
        }
        else
        {
            ret = ctc_acl_get_league_mode(&acl_league);
        }

        if (ret < 0)
        {
            continue;
        }

        ctc_cli_out("%-15s%-15u","Egress",prio);

        lkup_pp_en_bitmap = sys_usw_acl_get_lkup_pp_en_bmp(g_api_lchip, 1);

        for (idx = 0; idx < egs_acl_block_num; idx++)
        {
            ctc_cli_out("%u ", (CTC_IS_BIT_SET(acl_league.lkup_level_bitmap, idx) ? 1: 0));
        }

        ctc_cli_out("\n");
        if(detail && (acl_league.list_cnt > 1 || (1 == acl_league.list_cnt && CTC_IS_BIT_SET(lkup_pp_en_bitmap, acl_league.leagued_list[0]))))
        {
            ctc_cli_out("%-15u", acl_league.size ? acl_league.size : 1);
            for(idx=0; idx < acl_league.list_cnt; idx++)
            {
                if(CTC_IS_BIT_SET(lkup_pp_en_bitmap, acl_league.leagued_list[idx]))
                {
                    ctc_cli_out("*");
                }            
                ctc_cli_out("%-3u", acl_league.leagued_list[idx]);
            }
            ctc_cli_out("\n");
        }
    }

    return ret;

}

CTC_CLI(ctc_cli_usw_acl_show_entry_distribution,
        ctc_cli_usw_acl_show_entry_distribution_cmd,
        "show acl entry-info distribution priority PRIORITY (ingress | egress)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Entry info",
        "Entry distribution",
        "ACL priority",
        "ACL priority value",
        "Ingress",
        "Egress")
{

    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint8 dir = CTC_INGRESS;
    uint8 prio = 0;

    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (index != 0xFF)
    {
        dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        dir = CTC_EGRESS;
    }

    CTC_CLI_GET_UINT8("priority", prio, argv[0]);

    ret = sys_usw_acl_show_entry_distribution(g_api_lchip, dir, prio);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}
CTC_CLI(ctc_cli_usw_acl_set_upa_en,
            ctc_cli_usw_acl_set_upa_en_cmd,
            "acl upa enable",
            CTC_CLI_ACL_STR,
            "User priority arragment",
            "enable"
            )
{
    int32 ret = CLI_SUCCESS;


    ret = sys_usw_acl_set_upa_en(g_api_lchip);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_acl_reorder_stats_ptr,
            ctc_cli_usw_acl_reorder_stats_ptr_cmd,
            "acl reorder stats priority PRIORITY (ingress | egress)",
            CTC_CLI_ACL_STR,
            "Reorder",
            "Stats",
            "User priority arragment",
            "Priority value",
            "Ingress",
            "Egress")
{
    int32 ret = CLI_SUCCESS;
    uint8 index = 0xFF;
    uint32 fail_list[10] = {0};
    uint32 cnt = 10;
    /*sal_systime_t tv1, tv2;*/
    ctc_acl_reorder_t reorder;

    reorder.dir = CTC_INGRESS;
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        reorder.dir = CTC_EGRESS;
    }
    CTC_CLI_GET_UINT8_RANGE("priority", reorder.acl_priority, argv[0], 0, (reorder.dir == CTC_INGRESS ? 8: 3));
    
    /*sal_gettime(&tv1);*/
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_reorder_stats(g_api_ldev, &reorder, fail_list, &cnt);
    }
    else
    {
        ret = ctc_acl_reorder_stats(&reorder, fail_list, &cnt);
    }
    /*sal_gettime(&tv2);
    if(tv2.tv_usec >= tv1.tv_usec)
    {
        ctc_cli_out("USED  TIME:[%10u s:%3u ms]\n", tv2.tv_sec - tv1.tv_sec, (tv2.tv_usec - tv1.tv_usec)/1000);
    }
    else
    {
        ctc_cli_out("USED  TIME:[%10u s:%3u ms]\n", tv2.tv_sec - tv1.tv_sec - 1, (tv2.tv_usec + 1000000 - tv1.tv_usec)/1000);
    }*/
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_set_aset,
            ctc_cli_usw_acl_set_aset_cmd,
            "acl set aset ASET_ID (igs-tcam|egs-tcam|igs-hash) {" CTC_CLI_ACL_ASET_STR "profile PROFILE |}" ,
            CTC_CLI_ACL_STR,
            "Set",
            "Action field set",
            "Aset_id value",
            "Ingress tcam",
            "Egress tcam",
            "Ingress hash",
            CTC_CLI_ACL_ASET_STR_DESC,
            "Xdata profile id",
            "Xdata profile id value "
            )
{
    int32 ret = CLI_SUCCESS;
    /*sal_systime_t tv1, tv2;*/
    uint8 index = 0;
    uint8 index_aset = 0;
    ctc_acl_aset_t aset;
    sal_memset(&aset, 0, sizeof(aset));

    index = CTC_CLI_GET_ARGC_INDEX("igs-tcam");
    if(index != 0xff)
    {
        index_aset = index;
        aset.type = 0;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egs-tcam");
    if(index != 0xff)
    {
        index_aset = index;
        aset.type = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("igs-hash");
    if(index != 0xff)
    {
        index_aset = index;
        aset.type = 2;
    }
    index = CTC_CLI_GET_ARGC_INDEX("xdata");
    if (0xFF != index)
    {
        index = CTC_CLI_GET_ARGC_INDEX("profile");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("profile-id", aset.xdata_prof_id, argv[index + 1]);
        }
    }

    CTC_CLI_GET_UINT8_RANGE("aset_id", aset.aset_id, argv[0], 0, 255);
    CTC_CLI_PARSER_ASET(aset.w, index_aset)
    
    /*sal_gettime(&tv1);*/
    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_aset_fields(g_api_ldev, &aset);
    }
    else
    {
        ret = ctc_acl_set_aset_fields(&aset);
    }
    /*sal_gettime(&tv2);
    if(tv2.tv_usec >= tv1.tv_usec)
    {
        ctc_cli_out("USED  TIME:[%10u s:%3u ms]\n", tv2.tv_sec - tv1.tv_sec, (tv2.tv_usec - tv1.tv_usec)/1000);
    }
    else
    {
        ctc_cli_out("USED  TIME:[%10u s:%3u ms]\n", tv2.tv_sec - tv1.tv_sec - 1, (tv2.tv_usec + 1000000 - tv1.tv_usec)/1000);
    }*/
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}


CTC_CLI(ctc_cli_usw_acl_show_upa,
        ctc_cli_usw_acl_show_upa_cmd,
        "show acl upa-en (dir (ingress|egress)|)",
        "Show",
        CTC_CLI_ACL_STR,
        "User priority arragment",
        "Direct",
        "Ingress",
        "Egress"
        )
{
    int32 ret = 0;
    uint8 enable = 0;
    uint8 index = 0;
    uint8 dir=CTC_BOTH_DIRECTION;

    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if(index != 0xff)
    {
        dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if(index != 0xff)
    {
        dir = CTC_EGRESS;
    }

    ret = sys_usw_acl_get_upa_en(g_api_lchip,dir,&enable);
    if (ret < 0)
    {
        ctc_cli_out("ret = %d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("===============================\n");
    ctc_cli_out("upa-en, enable:%d\n", enable);
    ctc_cli_out("===============================\n");

    return ret;
}

extern uint32
sys_usw_acl_get_field_id(char* in);

#if defined(TSINGMA_MX) || defined(TSINGMA_GX) || defined(ARCTIC)
extern int32
sys_usw_acl_show_flex_keygen(uint8 lchip, uint8 dir, uint8 key_type, uint32 eid, uint32* data);
#define CTC_CLI_ACL_KEY_LEN     (160>>3)
CTC_CLI(ctc_cli_acl_show_flex_keygen,
        ctc_cli_usw_acl_show_flex_keygen_cmd,
        "show acl flex-keygen ("CTC_CLI_ACL_FLEX_KEY_STR"|KEY_TYPE) {(ingress|egress)",
        "Show",
        CTC_CLI_ACL_STR,
        "Flex key gen",
        CTC_CLI_ACL_FLEX_KEY_DESC,
        "Key type",
        "Ingress", "Egress"
        )
{
    int32 ret = CLI_SUCCESS;
    uint8 key_type = 0;
    uint8 dir = 0;
    uint8 loop = 0;
    uint8 index = 0;
    uint8 key_type_num = 0;


    key_type_num = sizeof(cli_key_str)/sizeof(char*);
    for (loop=0; loop<key_type_num; loop++)
    {
        if (!sal_strncasecmp(argv[0], cli_key_str[loop], sal_strlen(cli_key_str[loop])))
        {
            break;
        }
    }
    if (loop<key_type_num)
    {
        key_type = loop;
    }
    else
    {
        CTC_CLI_GET_UINT8("key type", key_type, argv[0]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    dir = (INDEX_VALID(index)? CTC_EGRESS: CTC_INGRESS);

    ret = sys_usw_acl_show_flex_keygen(g_api_lchip, dir, key_type, 0, NULL);

    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_acl_decode_program_key,
        ctc_cli_acl_decode_program_key_cmd,
        "acl decode program-key entry-id ID {part-0 DATA|part-1 DATA|part-2 DATA}",
        CTC_CLI_ACL_STR,
        "Decode",
        "Program Key",
        CTC_CLI_ACL_ENTRY_ID_STR,
        CTC_CLI_ACL_ENTRY_ID_VALUE,
        "Part 0", "Data",
        "Part 1", "Data",
        "Part 2", "Data"
        )
{
    int32  ret = CLI_SUCCESS;
    uint32 eid = 0;
    uint8* data = NULL;
    uint8 index = 0;
    uint8 loop = 0;

    data = mem_malloc(MEM_SYSTEM_MODULE, CTC_CLI_ACL_KEY_LEN * 3);
    if (NULL == data)
    {
        return CLI_ERROR;
    }

    CTC_CLI_GET_UINT32("entry id", eid, argv[0]);
    index = CTC_CLI_GET_ARGC_INDEX("part-0");
    if (INDEX_VALID(index))
    {
        if (sal_strlen(argv[index+1]) < CTC_CLI_ACL_KEY_LEN*2)
        {
            ctc_cli_out("%% Part0 Data len error!\n");
            return CLI_ERROR;
        }
        loop = 0;
        do
        {
            sal_sscanf(argv[index+1]+2*(CTC_CLI_ACL_KEY_LEN-1-loop), "%2hhx", &data[loop]);
        }while(++loop < CTC_CLI_ACL_KEY_LEN);
    }

    index = CTC_CLI_GET_ARGC_INDEX("part-1");
    if (INDEX_VALID(index))
    {
        if (sal_strlen(argv[index+1]) < CTC_CLI_ACL_KEY_LEN*2)
        {
            ctc_cli_out("%% Part1 Data len error!\n");
            return CLI_ERROR;
        }
        loop = 0;
        do
        {
            sal_sscanf(argv[index+1]+2*(CTC_CLI_ACL_KEY_LEN-1-loop), "%2hhx", &data[loop+CTC_CLI_ACL_KEY_LEN]);
        }while(++loop < CTC_CLI_ACL_KEY_LEN);
    }

    index = CTC_CLI_GET_ARGC_INDEX("part-2");
    if (INDEX_VALID(index))
    {
        if (sal_strlen(argv[index+1]) < CTC_CLI_ACL_KEY_LEN*2)
        {
            ctc_cli_out("%% Part1 Data len error!\n");
            return CLI_ERROR;
        }
        loop = 0;
        do
        {
            sal_sscanf(argv[index+1]+2*(CTC_CLI_ACL_KEY_LEN-1-loop), "%2hhx", &data[loop+CTC_CLI_ACL_KEY_LEN*2]);
        }while(++loop < CTC_CLI_ACL_KEY_LEN);
    }
    ret = sys_usw_acl_show_flex_keygen(g_api_lchip, 0, 0, eid, (uint32*)data);
    mem_free(data);

    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return ret;
}

#endif

CTC_CLI(ctc_cli_acl_set_flex_key_fields,
        ctc_cli_usw_acl_set_flex_key_fields_cmd,
        "acl set flex-key-fields ("CTC_CLI_ACL_FLEX_KEY_STR"|KEY_TYPE) {"CTC_CLI_FLEX_KEY_FIELD_STR_1"|} {"CTC_CLI_FLEX_KEY_FIELD_STR_2"|} (array-field FIELD |) \
        {ipv6-da-bmp BMP|ipv6-sa-bmp BMP|udf-bmp BMP|sudf-bmp BMP|size SIZE|compress-ether-type| pbm-width WIDTH (no-gport |) |is-hash|lkup-type ("CTC_CLI_ACL_LKUP_TYPE_STR")|}\
        ({origin-key-type ("CTC_CLI_ACL_FLEX_KEY_STR")| dir (ingress|egress)} {ether-type VALUE |l3-type VALUE |l4-type VALUE |l4-user-type VALUE| mode MODE | }|)",
        CTC_CLI_ACL_STR,
        "Create",
        "Flex key fields",
        CTC_CLI_ACL_FLEX_KEY_DESC,
        "Key type",
        CTC_CLI_FLEX_KEY_FIELD_DESC_1,
        CTC_CLI_FLEX_KEY_FIELD_DESC_2,
        "Field array of local xdata key-field",
        "Two-dimensional Array,array number is ctc_xdata_field_t,format is [[WIDTH ,OFFSET ,DATA ,MASK ,FLAG],[...]].For example,[[8,48,0]],DATA and FLAG is invalid.",
        "IPv6 DA Bitmap",
        "Bitmap in word",
        "IPv6 SA Bitmap",
        "Bitmap in word",
        "UDF Bitmap",
        "Bitmap in half word",
        "SUDF Bitmap",
        "Bitmap in half word",
        "Key size",
        "Key size value",
        "If set, use compress ether type",
        "Port bitmap width",
        "Width value",
        "Port bitmap formate without gport",
        "Is Hash Flex Key",
        "Lookup type", CTC_CLI_ACL_LKUP_TYPE_DESC,
        "Origin key type",
        CTC_CLI_ACL_FLEX_KEY_DESC,
        "Direction", "Ingress", "Egress",
        "Ether type", "Value",
        "Layer3 type", "Value",
        "Layer4 type", "Value",
        "Layer4 user type", "Value",
        "Flex hash key mode", 
        "0, none flex key mode; 1, append key; 2, double and append key 3,replace key")
{
    uint8  index = 0;
    uint8  loop = 0;
    uint8  fk_end = 255;
    uint8  key_type_num = 0;
    uint32 fld_id = 0;
    ctc_acl_flex_key_t acl_flex_key;
    ctc_xdata_field_t xdata_field[35];

    int32  ret = CLI_SUCCESS;

    key_type_num = sizeof(cli_key_str)/sizeof(char*);
    sal_memset(&acl_flex_key, 0, sizeof(ctc_acl_flex_key_t));
    sal_memset(xdata_field,0,sizeof(ctc_xdata_field_t)*35);

    for (loop=0; loop<key_type_num; loop++)
    {
        if (!sal_strncasecmp(argv[0], cli_key_str[loop], sal_strlen(cli_key_str[loop])))
        {
            break;
        }
    }
    if (loop<key_type_num)
    {
        acl_flex_key.key_type = loop;
    }
    else
    {
        CTC_CLI_GET_UINT8("key type", acl_flex_key.key_type, argv[0]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-da-bmp");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("ipv6 da bmp", acl_flex_key.ipv6_da_bmp, argv[index+1]);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-sa-bmp");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("ipv6 sa bmp", acl_flex_key.ipv6_sa_bmp, argv[index+1]);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("udf-bmp");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT16("udf bmp", acl_flex_key.udf_bmp, argv[index+1]);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("sudf-bmp");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT16("sudf bmp", acl_flex_key.sudf_bmp, argv[index+1]);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("size");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("size", acl_flex_key.size, argv[index+1]);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("compress-ether-type");
    if (INDEX_VALID(index))
    {
        acl_flex_key.compress_ether_type = TRUE;
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("is-hash");
    if (INDEX_VALID(index))
    {
        CTC_SET_FLAG(acl_flex_key.flag, CTC_ACL_FLEX_KEY_FLAG_HASH);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("lkup-type");
    if (INDEX_VALID(index))
    {
        CTC_SET_FLAG(acl_flex_key.flag, CTC_ACL_FLEX_KEY_FLAG_LKUP_TYPE);
        CTC_CLI_ACL_LKUP_TYPE_SET(index+1, acl_flex_key.lkup_type);
        fk_end = index < fk_end ? index : fk_end;
    }
    index = CTC_CLI_GET_ARGC_INDEX("dir");
    if (INDEX_VALID(index))
    {
        acl_flex_key.dir = CTC_CLI_STR_EQUAL_ENHANCE("ingress", index+1) ? CTC_INGRESS : CTC_EGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("pbm-width");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("port bitmap mode", acl_flex_key.port_bitmap_width, argv[index+1]);
        if(0xFF != CTC_CLI_GET_ARGC_INDEX("no-gport"))
        {
            acl_flex_key.flag |= CTC_ACL_FLEX_FLAG_PBM_NO_GPORT;
        }
        fk_end = index < fk_end ? index : fk_end;
    }
    
    index = CTC_CLI_GET_ARGC_INDEX("xdata");
    if (index != 0xFF)
    {
        acl_flex_key.xdata.num = ctc_cmd_get_map_array(1,(void*) (xdata_field),argv[index+2]);
        acl_flex_key.xdata.fields = xdata_field;
    }

    index = CTC_CLI_GET_ARGC_INDEX("mode");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("mode", acl_flex_key.mode, argv[index+1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("origin-key-type");
    if (INDEX_VALID(index))
    {
        for (loop=0; loop<key_type_num; loop++)
        {
            if (!sal_strncasecmp(argv[index+1], cli_key_str[loop], sal_strlen(cli_key_str[loop])))
            {
                break;
            }
        }
        if (loop>=key_type_num)
        {
            return CLI_ERROR;
        }
        acl_flex_key.origin_key_type = loop;
        fk_end = index < fk_end ? index : fk_end;
    }
    if (fk_end != 255)
    {
        for (index=1; index<fk_end; index++)
        {
            fld_id = sys_usw_acl_get_field_id(argv[index]);
            if (fld_id != 0xFFFFFFFF) 
            {
                CTC_ACL_KSET_ADD(acl_flex_key.kset, fld_id);
            }
        }
        index = CTC_CLI_GET_SPECIFIC_INDEX("ether-type", fk_end);
        if (INDEX_VALID(index))
        {
            CTC_CLI_GET_UINT8("ether type", acl_flex_key.ether_type, argv[fk_end+index+1]);
        }
        index = CTC_CLI_GET_SPECIFIC_INDEX("l3-type", fk_end);
        if (INDEX_VALID(index))
        {
            CTC_CLI_GET_UINT8("l3 type", acl_flex_key.l3_type, argv[fk_end+index+1]);
        }
        index = CTC_CLI_GET_SPECIFIC_INDEX("l4-type", fk_end);
        if (INDEX_VALID(index))
        {
            CTC_CLI_GET_UINT8("l4 type", acl_flex_key.l4_type, argv[fk_end+index+1]);
        }
        index = CTC_CLI_GET_SPECIFIC_INDEX("l4-user-type", fk_end);
        if (INDEX_VALID(index))
        {
            CTC_CLI_GET_UINT8("l4 user type", acl_flex_key.l4_user_type, argv[fk_end+index+1]);
        }
    }
    else
    {
        for (index=1; index<argc; index++)
        {
            fld_id = sys_usw_acl_get_field_id(argv[index]);
            if (fld_id != 0xFFFFFFFF) CTC_ACL_KSET_ADD(acl_flex_key.kset, fld_id);
        }
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_set_flex_key_fields(g_api_ldev, &acl_flex_key);
    }
    else
    {
        ret = ctc_acl_set_flex_key_fields(&acl_flex_key);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return ret;
}

extern void
sys_usw_acl_show_kset(uint8 lchip, ctc_acl_flex_key_t *acl_flex_key);
CTC_CLI(ctc_cli_show_acl_flex_key_fields,
        ctc_cli_usw_show_acl_flex_key_fields_cmd,
        "show acl flex-key-fields ("CTC_CLI_ACL_FLEX_KEY_STR"|KEY_TYPE) (dir (ingress|egress)|) (origin-key-type ("CTC_CLI_ACL_FLEX_KEY_STR") |)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "Flex key fields",
        CTC_CLI_ACL_FLEX_KEY_DESC,
        "Key type",
        "Direction",
        "Ingress",
        "Egress",
        "Origin key type",
        CTC_CLI_ACL_FLEX_KEY_DESC)
{
    uint8  loop = 0;
    uint8  index = 0;
    int32  ret = CLI_SUCCESS;
    ctc_acl_flex_key_t acl_flex_key;
    uint8 lchip = 0;
    uint8 key_type_num = 0;

    sal_memset(&acl_flex_key, 0, sizeof(ctc_acl_flex_key_t));
    key_type_num = sizeof(cli_key_str)/sizeof(char*);
    for (loop=0; loop<key_type_num; loop++)
    {
        if (!sal_strncasecmp(argv[0], cli_key_str[loop], sal_strlen(cli_key_str[loop])))
        {
            break;
        }
    }
    if (loop<key_type_num)
    {
        acl_flex_key.key_type = loop;
    }
    else
    {
        CTC_CLI_GET_UINT8("key type", acl_flex_key.key_type, argv[0]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dir");
    if (INDEX_VALID(index))
    {
        acl_flex_key.dir = CTC_CLI_STR_EQUAL_ENHANCE("ingress", index+1) ? CTC_INGRESS : CTC_EGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("origin-key-type");
    if (INDEX_VALID(index))
    {
        for (loop=0; loop<key_type_num; loop++)
        {
            if (!sal_strncasecmp(argv[index+1], cli_key_str[loop], sal_strlen(cli_key_str[loop])))
            {
                break;
            }
        }
        if (loop>=key_type_num)
        {
            return CLI_ERROR;
        }
        acl_flex_key.origin_key_type = loop;
        index = CTC_CLI_GET_ARGC_INDEX("dir");
        if (INDEX_VALID(index))
        {
            if (CLI_CLI_STR_EQUAL("ingress", index+1))
            {
                acl_flex_key.dir = CTC_INGRESS;
            }
            else
            {
                acl_flex_key.dir = CTC_EGRESS;
            }
        }
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_acl_get_flex_key_fields(g_api_ldev, &acl_flex_key);
    }
    else
    {
        ret = ctc_acl_get_flex_key_fields(&acl_flex_key);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    lchip = g_api_lchip;
    sys_usw_acl_show_kset(lchip, &acl_flex_key);

    return ret;
}

#if defined(TSINGMA_MX) || defined(TSINGMA_GX) || defined(ARCTIC)
CTC_CLI(ctc_cli_usw_acl_create_presel,
        ctc_cli_usw_acl_create_presel_cmd,
        "acl (create|destroy) presel PRESEL_ID {acl-priority PRIO|entry-prio PRIO|key-type KEY_TYPE| (ingress|egress) |}",
        CTC_CLI_ACL_STR,
        "Create",
        "Destroy",
        "Pre-select",
        "Select ID",
        "ACL priority",
        "Priority value",
        "Entry priority",
        "Priority value",
        "Key type",
        "Key type value",
        "Ingress",
        "Egress")
{
    int32  ret = CLI_SUCCESS;
    uint8  is_create = 0;
    uint8  index = 0;
    ctc_acl_presel_t acl_presel;

    sal_memset(&acl_presel, 0, sizeof(ctc_acl_presel_t));
    if (CTC_CLI_STR_EQUAL_ENHANCE("create", 0))
    {
        is_create = 1;
    }
    CTC_CLI_GET_UINT16("presel id", acl_presel.presel_id, argv[1]);
    index = CTC_CLI_GET_ARGC_INDEX("acl-priority");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("acl priority", acl_presel.lkup_level, argv[index+1]);
        acl_presel.flag |= CTC_ACL_PRESEL_FLAG_LKUP_LEVEL;
    }
    index = CTC_CLI_GET_ARGC_INDEX("entry-prio");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("entry priority", acl_presel.entry_pri, argv[index+1]);
        acl_presel.flag |= CTC_ACL_PRESEL_FLAG_ENTRY_PRIO;
    }
    index = CTC_CLI_GET_ARGC_INDEX("key-type");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT8("key type", acl_presel.key_type, argv[index+1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (INDEX_VALID(index))
    {
        acl_presel.dir = CTC_EGRESS;
    }
    if(g_ctcs_api_en)
    {
        ret = is_create? ctcs_acl_create_presel(g_api_ldev, &acl_presel): ctcs_acl_destroy_presel(g_api_ldev, acl_presel.presel_id);
    }
    else
    {
        ret = is_create? ctc_acl_create_presel(&acl_presel): ctc_acl_destroy_presel(acl_presel.presel_id);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return ret;
}

extern int32
sys_tmm_acl_show_presel(uint8 lchip, uint8 type, uint16 presel_id, uint8 detail);
CTC_CLI(ctc_cli_usw_show_acl_presel,
        ctc_cli_usw_show_acl_presel_cmd,
        "show acl presel (presel-id PRESEL_ID|all) {detail|}",
        CTC_CLI_SHOW_STR,
        CTC_CLI_ACL_STR,
        "ACL presel",
        "Presel ID",
        "Presel ID Value",
        "All entries",
        "Detail")
{
    int32  ret = CLI_SUCCESS;
    uint8  index = 0;
    uint8  type = 0, detail = 0;
    uint16 presel_id = 0;

    index = CTC_CLI_GET_ARGC_INDEX("presel-id");
    if (INDEX_VALID(index))
    {
        CTC_CLI_GET_UINT16("presel id", presel_id, argv[index+1]);
        type = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("detail");
    if (INDEX_VALID(index))
    {
        detail = 1;
    }
    ret = sys_tmm_acl_show_presel(g_api_lchip, type, presel_id, detail);
    if (ret < 0)
    {
        ctc_cli_out("%% ret=%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return ret;
}
#endif

int32
ctc_usw_acl_cli_init(void)
{
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_flex_key_fields_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_show_acl_flex_key_fields_cmd);
#if defined(TSINGMA_MX) || defined(TSINGMA_GX) || defined(ARCTIC)
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_create_presel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_show_acl_presel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_flex_keygen_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_acl_decode_program_key_cmd);
#endif
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_entry_info_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_group_info_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_status_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_field_range_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_udf_entry_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_remove_udf_entry_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_remove_udf_entry_key_field_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_udf_entry_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_udf_entry_status_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_key_field_cmd_0);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_key_field_cmd_1);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_action_field_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_remove_action_field_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_entry_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_hash_entry_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_mac_field_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_ipv4_field_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_mpls_field_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_ipv6_field_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_l2_l3_field_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_nsh_field_sel_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_cid_pair_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_cid_pair_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_create_group_ext_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_block_status_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_cid_prio_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_league_mode_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_entry_distribution_cmd);
    install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_acl_set_upa_en_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_aset_info_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_aset_info1_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_reorder_stats_ptr_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_aset_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_upa_cmd);

    return 0;
}

int32
ctc_usw_acl_cli_deinit(void)
{
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_flex_key_fields_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_show_acl_flex_key_fields_cmd);
#if defined(TSINGMA_MX) || defined(ARCTIC)
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_create_presel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_show_acl_presel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_flex_keygen_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_acl_decode_program_key_cmd);
#endif
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_entry_info_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_group_info_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_status_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_field_range_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_udf_entry_status_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_remove_udf_entry_key_field_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_udf_entry_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_remove_udf_entry_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_udf_entry_cmd);

    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_key_field_cmd_0);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_key_field_cmd_1);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_action_field_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_remove_action_field_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_entry_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_hash_entry_cmd);

    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_mac_field_sel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_ipv4_field_sel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_mpls_field_sel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_ipv6_field_sel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_l2_l3_field_sel_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_hash_nsh_field_sel_cmd);


    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_add_cid_pair_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_cid_pair_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_create_group_ext_cmd);

    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_block_status_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_cid_prio_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_league_mode_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_entry_distribution_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_aset_info_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_aset_info1_cmd);

    uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_acl_set_upa_en_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_reorder_stats_ptr_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_set_aset_cmd);
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_acl_show_upa_cmd);

    return 0;
}

